Guest User

Untitled

a guest
Mar 3rd, 2011
306
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 KB | None | 0 0
  1. # #include <iostream>
  2. # #include <vector>
  3.  #include <algorithm>
  4.  #include <cctype>
  5.  #include <string>
  6.  
  7.  
  8.  using namespace std;
  9.  
  10.  
  11.  #define for_n for(int i=0;i!=n; ++i)
  12.  
  13.  
  14.  int main()
  15.  {
  16.      vector <string> v;
  17.      string s;
  18.      cin>>s;
  19.      int n; cin>>n;
  20.      for_n {string t; cin>>t; v.push_back(t);}
  21.      sort(v.begin(), v.end());
  22.      for_n if (s==v[i].substr(0,s.length())){cout<<v[i];return 0;} else {cout<<s; break;}
  23.  }
Advertisement
Add Comment
Please, Sign In to add comment