fork download
#include <map>
#include <cstdio>
#include <iostream>
using namespace std;

typedef map<std::string, int> wc;
void printmap(const wc& m) {
     for(wc::const_iterator i=m.begin(); i!=m.end(); ++i)
         std::cout << i->first << "->" << i->second << '\n';
}

int main() {
    int c;
    string cc, nombre;
    wc m;
    std::cin >> c;
    while (c--) {
        std::cin >> cc; 
        std::getline(std::cin, nombre);
        ++m[cc]; // This should work
    }
    printmap(m);
}
Success #stdin #stdout 0.01s 2820KB
stdin
3
Spain Donna Elvira
England Jane Doe
Spain Donna Anna
stdout
England->1
Spain->2