If you just need to read from std:cin, then you can skip the stringstream, but the logic is the same. Keep reading in word after word, remove any characters which are not letters, and then check the last two characters.
Start with a program like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
std::size_t count = 0;
while(std::cin >> word)
//for loop: remove characters which are not letters
//if statement: check the last two characters -> ++count;
std::cout << count << std::endl;
I've already written a lot for you, you may want to rewrite it yourself so you understand how it works.
I'm assuming you meant "for loop" and not "if statement".
There is no replace function for strings, which is fine because you won't need one. All you need is the substring before the character to remove and the substring after the character to remove. You could also do it with iterators, but considering what you've said you've not learned I am willing to gues you haven't learned about iterators either.
yea i meant for loop. i have tried a bunch of stuff couldnt get it to work. cant spend to much time on this got to study other questions. i wouldnt mind if you showed me how but if not thanks for all your help. helped me get a better idea of what i was doing :)