The difficulty in giving you advice here is that I don't know which features of C++ you have covered already. Sometimes books want you to come up with a nifty little algorithm using the features you have learned so far. In that cause more "elegant" solutions using C++ standard library features might be missing the mark. For instance, if you're allowed to use sorting, then you could sort your word vector, thereby packing all identical words together. Then it would just be a matter of printing the first word, advancing through the vector (counting up) while the words remain the same and printing that number as soon as a non-identical word comes up; lather, rinse, repeat.
I like that you're already using size_type. If you want you can look up the auto keyword which can deduce the type for you (via the assignment).
Code:
auto size = words.size(); // gee, I must be a vector<string>::size_type!
In your case you could also do:
Code:
if (words.size() == 0)
{ ... }
// or better yet
if (words.empty())
{ ... }
Happy coding!