#include #include #include #include using namespace std; int main() { map mapa; string s; cin >> s; int n; cin >> n; vector words; for(int i = 0; i < n; i++) { string x; cin >> x; words.push_back(x); mapa[x] = true; } if(mapa[s] == false) { cout << s << endl; } else { for(int i = 1; i <= n + 1; i++) { string tmp = s + to_string(i); if(mapa[tmp] == false) { cout << tmp << endl; break; } } } return 0; }