Created
October 28, 2017 00:02
-
-
Save KhaledElshamy/7f7577311c1af84414d0531f2167ffb5 to your computer and use it in GitHub Desktop.
C. Registration System Solution-Codeforces
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
using namespace std; | |
//Compiler version g++ 6.3.0 | |
int main() | |
{ | |
int n,count=0; | |
string s; | |
cin>>n; | |
set<string>s1; | |
map<string,int>p; | |
for(int i=0;i<n;i++){ | |
cin>>s; | |
if(s1.find(s)!=s1.end()){ | |
p[s]++; | |
cout<<s<<p[s]<<endl; | |
} | |
else{ | |
p[s]=count; | |
cout<<"OK"<<endl; | |
} | |
s1.insert(s); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks!