#include <set> #include <iostream> #include <cstdio> #include <string> using namespace std; char buf[100]; char *digitToString(int n){ sprintf(buf, "%d", n); return buf; } int main(){ int n; string str, temp; set<string> st; cin >> n; while(n--){ cin >> str; if(st.count(str) == 0){ st.insert(str); cout << "OK" << endl; } else{ for(int i = 1; ; ++i){ temp = str; if(st.count(temp.append(digitToString(i))) == 0){ st.insert(temp); cout << temp << endl; break; } } } } return 0; }
801811 | 长木 | Registration system | Accepted | 0 | 308 | C/C++ | 04-08 09:19:26 |