A given string needs to be modified so that there are no periods. The rest of the string remains intact.
I thought of using an iterative approach and using string::erase. In java, I could have easily accomplished it with replaceAll function. Thinking along those lines a developer published a solution :
temp.erase(remove(temp.begin(),temp.end(),'.'),temp.end());
The line of code works perfectly. However I failed to understand how it works. As far as my understanding goes the erase function deletes all characters in a range. The remove function is returning the iterator to the point after removing the periods, and then the erase function is erasing from that point. I'm confused. Any ideas?