http://codeforces.com/problemset/problem/4/C
水题,用STL map秒杀……
AC代码(C++11):
#include <iostream>
#include <unordered_map>
#include <string>
/*
Problem: Registration system
Source: Codeforces 4C
Author: fts2001
*/
using namespace std;
unordered_map<string,int> mp;
int n;
int main(){
ios::sync_with_stdio(false);
cin>>n;
while(n--){
string s;
cin>>s;
if(!mp[s])cout<<"OK\n";
else cout<<s<<mp[s]<<endl;
mp[s]++;
}
return 0;
}