SHARE
TWEET

Save Ironman

fahimkamal63 Apr 23rd, 2019 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<iostream>
  2. #include<cstdio>
  3. #include<string>
  4. #include<cctype>
  5.  
  6. using namespace std;
  7.  
  8. int take_alphabet(string &s, int n){
  9.     int i;
  10.     for(i = 0; i < n; i++){
  11.         s[i] = tolower(s[i]);
  12.         if(s[i] >= 'a' && s[i] <= 'z'){
  13.             continue;
  14.         }
  15.         else{
  16.             s.erase(i,1);
  17.             i--; n--;
  18.         }
  19.     }
  20.     return n;
  21. }
  22.  
  23. int main(){
  24.     int t; cin >> t;
  25.     cin.ignore();
  26.     while(t--){
  27.         string str;
  28.        
  29.         getline(cin , str);
  30.         int n = str.length();
  31.         n = take_alphabet(str, n);
  32.         //cout << str << endl;
  33.         int i = 0, j= n-1;
  34.         int flag = 0;
  35.         while(i < j){
  36.             if(str[i] != str[j]){
  37.                 flag = 1;
  38.                 break;
  39.             }
  40.             i++; j--;
  41.         }
  42.  
  43.         if(flag) cout << "NO\n";
  44.         else cout << "YES\n";
  45.     }
  46. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top