CodeForces 4C

#include <iostream>
#include <string>
#include <map>
using namespace std;

int n;

int main()
{
    string str;
    map<string,int> q;
    cin >> n;
    for(int i = 1;i <= n;i ++)
    {
        cin >> str;
        if(q[str] > 0)
        {
            cout << str << q[str] << endl;
            q[str] ++;
        }
        else
        {
            cout << "OK" << endl;
            q[str] = 1;
        }
    }
    return 0;
}




發佈了69 篇原創文章 · 獲贊 1 · 訪問量 1萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章