Before I saw Elba, I. D', I used to mighty

Source: Internet
Author: User
Tags alphabetic character

Title Description

You've heard of a palindrome, have you? The so-called palindrome, simply speaking, is to follow the reading and the reverse reading are the same. There have also been palindrome poem in Chinese history, of which the top four are:

Spring Ying Cry Shore Willow make spring Clear, Liu Yuchun clear Night Moon Ming. Ming Moonlight Clear Spring willow, clear spring Willow Shore Cry Warbler. Summer Fragrant lotus green water moves cool, the water moves cool summer long. The long summer breeze moves the water, the cool breeze moves Suibilian fragrant. Autumn Autumn Jiangchuyan, Yan Su sha Chau shallow water flow. Flowing water shallow Chau sha su yan, Chau sha su Yan Chujiangqiu. Winter The red stove through the charcoal to roast the wind, the charcoal is scorching cold winter. Winter Dragon Royal Wind Cold roast charcoal, cold burn charcoal furnace red.

Let's come Today "worship, but not fawning". Let's not consider the Chinese palindrome for the moment, but consider the English palindrome. The Simple English palindrome has: ABA, Madam and so on. We now give a definition of palindrome: filter out all non-alphabetic characters (including spaces), regardless of the case of the letter, the words, phrases or sentences that are the same from left to right and to left. The most famous palindrome in English is said to have been from comrade Napoleon's hand: Able was I ere I saw Elba. Meaning: Before I saw Elba, I. D', I was mighty. Note: Here ere is antiquity, now occasionally someone uses, and before (in ...). Former) synonymous, comrade Napoleon was exiled to Elba Island after the Russian war failed.

Input

The first behavior is an integer t, which indicates that there is a T group of test data. Next there are t lines, one string per line. Each string must contain an alphabetic character.

Output

For each string, determine if it is a palindrome that we define, or output No if it is output yes.

Sample input
5abcMadamMadam, I ' m Adam. Golf, No Sir, prefer prison flog! Able was I ere I saw Elba.
Sample output
Noyesyesyesyes
#include <iostream> #include <cmath> #include <cstring> using namespace std; const int a = 100; Char str[a+1]; Char t[a+1];     int main () {int j=0,n,i,len,f;     CIN >> N;     Cin.get ();         while (n--) {char t[a+1]={0};         f=1;         j=0;        Cin.getline (str,a+1);                for (i=0;str[i]!= '; i++) {if ((str[i]>= ' a ' &&str[i]<= ' Z ') ||            (str[i]>= ' A ' &&str[i]<= ' Z '))                {T[j]=str[i];            j + +;        }}/*for (i=0;t[i]!= '; i++) {cout << t[i] << Endl;        } */Len=strlen (t);                for (i=0;i<len/2;i++) {if ((t[i]!=t[len-1-i)) &&abs (T[i]-t[len-1-i])!=32) {            f=0;        }} if (f==0) {cout << "No" << Endl; } else {cout &Lt;< "Yes" << Endl; }} return 0;  }

Before I saw Elba, I. D', I used to mighty

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.