language: C++ 4.7.2 (gcc-4.7.2)
date: 345 days 3 hours ago
link:
visibility: public
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#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);
}