1 solutions

  • 1
    @ 2025-11-30 13:37:39
    #include<bits/stdc++.h>
    using namespace std;
    int n; 
    int main(){
    	cin>>n;
    	map<string,int> h;
    	for(int i=1;i<=n;i++){
    		string s;
    		cin>>s;
    		if(h.count(s)){
    			cout<<s<<"("<<h[s]<<")"<<endl;
    		}else{
    			cout<<s<<endl;
    		}
    		h[s]++;
    	}
    	return 0;
    }
    
    

    Information

    ID
    2727
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    3
    Tags
    # Submissions
    12
    Accepted
    6
    Uploaded By