Best to start from your last question first.
str.find(s,p) looks for s, starting from index p (rather than the start) - see:
http://www.cplusplus.com/reference/string/string/find/
Here, your program starts by looking for an "o", replaces it with '_', moves on a letter (the
++i statement) to 'm'. Then it will try to find a subsequent 'm' starting at the next position (the
i+1 on line 11), and replace it with '_'. And so on.
It basically keeps looking for a letter, replaces it with underscore, then repeats, but looking for the letter which follows that replaced. Here, this will give the sequence 'o', 'm', 'c', which are replaced in turn by underscore '_'. The while loop stops when the searched-for letter is not found in any remaining string (indicated by
find returning
string::npos).