Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<string>
- #include<cctype>
- using namespace std;
- bool chack(char a){
- if(isalpha(a)) return 1;
- if(isdigit(a)) return 1;
- else return 0;
- }
- int main(){
- int t; cin >> t;
- cin.ignore();
- while(t--){
- string s;
- getline(cin, s);
- //cout << s << endl;
- string r;
- for(int i = 0; i < s.length(); i++){
- if(chack(s[i])){
- r += tolower(s[i]);
- }
- }
- //cout << r << endl;
- int j = r.size() - 1, i = 0;
- int flag = 1;
- while(i < j){
- if(r[i] != r[j]){
- flag = 0;
- break;
- }
- i++; j--;
- }
- if(flag) cout << "YES\n";
- else cout << "NO\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement