Quote Originally Posted by ninja9578 View Post
You are looking for the index where the string changes from one char to another?

Code:
std::string mystring = "ggaagaaag";
size_t index = 0;
char last = '\0';
for(std::string::iterator i = mystring.begin(); i < mystring.end(); ++i, ++index){
    if (*i != last) std::cout << index;
    last = *i;
}
std::cout << index;
Is that what you are looking for?
That's what I originally thought was required, but the output from this doesn't match the results of the given examples.