Source Code
#include <bits/stdc++.h>

using namespace std;
#define pb push_back
typedef long long ll;

int main(){
     int di=1000000007;
	int T,n,k,t,a,c=0;
          cin>>n;
          string s;
          unordered_map<string,int>map;

         for(t=0;t<n;t++){
           cin>>s;
           if(map[s]==0){
             map[s]++;
              cout<<"OK\n";
           }else{
             map[s]++;
             s+=to_string(map[s]-1);
             map[s]++;
             cout<<s<<"\n";
           }
         }

}
Copy
Registration System mohammed_mraish
GNU G++17
1 ms
188 KB
Wrong Answer