You didn't specify what you've tried so far. So I don't know if this is an exact answer to your question but here is my hint for you:
you can use the standard std::map[^] container in order to simplify things a lot.
Here is a quick example for you:
#include <iostream>
#include <sstream>
#include <string>
#include <map>
int main()
{
std::string str("woo coo woo poo noo chho");
std::string word;
std::istringstream iss(str);
std::map<std::string, std::size_t> occurrences;
while (iss >> word) ++occurrences[word];
for (std::map<std::string, std::size_t>::iterator it = occurrences.begin();
it != occurrences.end(); ++it)
{
std::cout << "Word: " << it->first << "\t Occurrences: " << it->second << std::endl;
}
std::cin.get();
return 0;
}
This program is only a demo but it might be useful for you.
If you have some problems please update your original question and/or post a comment but this time please be specific about your problem. :)