document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. string str;
  9. int n;
  10. cin>>n;
  11. for(int i=0;i<n;i++)
  12. {
  13. cin>>str;
  14. //getline(cin,str);
  15. string::iterator it;
  16. string::reverse_iterator rit;
  17. bool isReversed=true;
  18. for ( it=str.begin() , rit=str.rbegin() ; rit < str.rend() && it<str.end(); it++ , rit++ )
  19. {
  20. while(!isalpha(*it))
  21. {
  22. it++;
  23. }
  24. while(!isalpha(*rit))
  25. {
  26. rit++;
  27. }
  28.  
  29. if(tolower(*it)!=tolower(*rit))
  30. {
  31. isReversed=false;
  32. break;
  33. }
  34.  
  35. }
  36.  
  37. if(isReversed)
  38. {
  39. cout<<"yes"<<endl;
  40. }
  41. else
  42. {
  43. cout<<"no"<<endl;
  44. }
  45. }
  46. return 0;
  47. }
');