fork(1) download
  1. #include <algorithm>
  2. #include <iostream>
  3. #include <string>
  4. #include <vector>
  5. #include <map>
  6.  
  7. using namespace std;
  8.  
  9. int main()
  10. {
  11. vector<string> s;
  12. int n;
  13. cin>>n;
  14. s.resize(n);
  15. for(auto i:s)cin>>i;
  16. map<char,int> mm;
  17. for(int i=0;i<s[0].size();i++){
  18. for(auto j:s)mm[j[i]]++;
  19. cout<<max_element(mm.begin(),mm.end(),[](pair<char,int> a,pair<char,int> b){return a.second<b.second;})->first;
  20. mm.clear();
  21. };
  22. return 0;
  23. }
  24.  
Success #stdin #stdout 0s 3468KB
stdin
4
misspell
misspill
masspell
messpell
stdout
misspell