UVa – 10420 – List of Conquests

#include <cstdio>
#include <cstring>
#include <string>
#include <map>
#include <set>
using namespace std;
int main() {
	int n;
	char country[80], mara_momes[80];
	map<string, int> m;
	scanf("%d\n", &n);

	while (n-- && scanf("%s", country) == 1 && gets(mara_momes))
		m[string(country)] = m[string(country)] + 1;

	for (map<string, int>::iterator it = m.begin(); it != m.end(); it++)
		printf("%s %d\n", it->first.c_str(), it->second);

	return 0;
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: