Sounds like the problem map<string, int> was born to solve.