Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save KhaledElshamy/7f7577311c1af84414d0531f2167ffb5 to your computer and use it in GitHub Desktop.
Save KhaledElshamy/7f7577311c1af84414d0531f2167ffb5 to your computer and use it in GitHub Desktop.
C. Registration System Solution-Codeforces
#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;
}
@nobleknightt
Copy link

Thanks!

@gvnee
Copy link

gvnee commented Apr 20, 2022

It's working without set.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment