fork download
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7. // your code goes here
  8. int n;
  9. string s, t;
  10. string m;
  11. bool inicio=true;
  12. bool dif=false;
  13. char ans;
  14. cin>>n;
  15. cin>>s;
  16. int w=s.size();
  17.  
  18. for (int q=1;q<n;q++)
  19. {cin>>t;
  20. for (long long int i=0;i<=w;i++)
  21. {
  22. if(s[i]=='?')
  23. s[i]=t[i];
  24. else if (t[i]!='?'&&s[i]!=t[i])
  25. s[i]='!';
  26. }
  27. }
  28. for(int i=0;i<w;i++)
  29. {
  30. if(s[i]=='?') s[i]='y';
  31. else if(s[i]=='!') s[i]='?';
  32. }
  33. cout<<s<<endl;
  34. return 0;
  35. }
Success #stdin #stdout 0s 16064KB
stdin
1
?a?b
stdout
yayb