Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # #include <iostream>
- # #include <vector>
- #include <algorithm>
- #include <cctype>
- #include <string>
- using namespace std;
- #define for_n for(int i=0;i!=n; ++i)
- int main()
- {
- vector <string> v;
- string s;
- cin>>s;
- int n; cin>>n;
- for_n {string t; cin>>t; v.push_back(t);}
- sort(v.begin(), v.end());
- for_n if (s==v[i].substr(0,s.length())){cout<<v[i];return 0;} else {cout<<s; break;}
- }
Advertisement
Add Comment
Please, Sign In to add comment