fork download
  1. #include<bits/stdc++.h>
  2. #include<string>
  3. using namespace std;
  4. int main(){
  5. int t;
  6. cin>>t;
  7.  
  8. while(t--)
  9. {
  10. int i;
  11. string str;
  12. getline(cin,str);
  13. cout<<endl;
  14. int n=str.length();
  15. if(n&2==0)
  16. {
  17. for(i=0;i<=n/2;i++)
  18. {
  19. if(str[i]==str[n-1-i] )
  20. {
  21. cout<<"YES"<<endl;
  22. }
  23. else
  24. {
  25. cout<<"NO"<<endl;
  26. }
  27. }
  28. }
  29. else
  30. {
  31. for(i=0;i<n/2;i++)
  32. {
  33. if(str[i]==str[n-1-i] )
  34. {
  35. cout<<"YES"<<endl;
  36. }
  37. else
  38. {
  39.  
  40. cout<<"NO"<<endl;
  41. }
  42.  
  43. }
  44.  
  45.  
  46.  
  47.  
  48. }
  49. }
  50. return 0;
  51. }
  52.  
Success #stdin #stdout 0.01s 5508KB
stdin
Standard input is empty
stdout