Probably best to just demonstrate with an example.
So an input of "$$?@@" becomes "**?"
An input of "$@$?@$@" becomes "*@*?$"
When forming the second string, I suggest just starting with an empty string.
Iterate over every character of the first string, and have a bool for whether or not the '?' character has been seen yet.
Does this mean that you are to use a "std::string" to hold what you need to work on? Or is it also meaning that you are to use the member functions of the string class to achieve the proper result?
Ganado 's solution although very good may not be the correct solution.
Andy
P.S. I am thinking that you may need to use the "string.find" or one of the other finds and "string.replace".