So I have to make a code checks if a sentence is read the same forwards as backwards. Then make sure there are no duplicates of the same word used twice, ex - "I ate the the pizza."
I split the sentence into words and placed them in vector words. This is all I have so for this function before I got stuck. I was thinking about creating a new string and using pop_back to delete consecutive elements that are the same but I'm not too familiar with pop_back. Is that the right way to create this function or is there an easier way.
Have you thought of using maps? [http://www.cplusplus.com/reference/map/map/ ]. Maps are containers that can change their key value and mapped value. Same as vectors and sets, they also have iterators, but they are used a bit differently.
Here's a code example for finding duplicate words:
Are you looking for duplicate words or repeated words? In other words, if the sentence is "When did the dog eat the bone" then should you consider "the" to be a duplicate?