problem :- spoj.com/problems/CLONE/
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <cstdio>
#include <algorithm>
#include <set>
using namespace std;
int main()
{
int n,my;
scanf("%d%d",&n,&my);
while ( n != 0 && my != 0 ) {
vector<string> v;
set<string> se;
for ( int i = 0; i < n; i++ ) {
string s;
cin >> s;
v.push_back(s);
se.insert(s);
}
set<string> :: iterator itt;
map<string,int> m;
for ( itt = se.begin();itt != se.end(); itt++ ) {
int k = (int) count(v.begin(),v.end(),*itt);
m[*itt] = k;
}
map<string,int> :: iterator it;
for ( int i = 1; i <= n; i++ ) {
int count = 0;
for ( it = m.begin(); it != m.end(); it++ ) {
if ( (*it).second == i ) {
count++;
}
}
cout << count << endl;
}
scanf("%d%d",&n,&my);
}
return 0;
}