Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main13()
- {
- std::string a;
- bool q,p,p1,p2,t;
- std::cout<<"Input word"<<std::endl;
- std::cin>>a;
- if (a.length()!=7){
- std::cout<<"ERROR:: Input 7-letter word!!!"<<std::endl;
- std::cin>>a;
- }
- p1 = ((a[0]>64) && (a[1]>64) && (a[2]>64) && (a[4]>64) && (a[5]>64) && (a[6]>64));
- p2 = ((a[0]<123) && (a[1]<123) && (a[2]<123) && (a[4]<123) && (a[5]<123) && (a[6]<123));
- p = p1 && p2;
- q = (((a[0]+32==a[6]) || (a[0]==a[6]+32)) && ((a[1]+32==a[5]) || (a[1]==a[5]+32)) && ((a[2]+32==a[4]) || (a[2]==a[4]+32)));
- t = ((a[0]==a[6]) && (a[1]==a[5]) && (a[2]==a[4]));
- if (t) std::cout<<"This is Palindrome!"<<std::endl;
- else if (q && p) std::cout<<"This is Palindrome, but letters are in different registers!"<<std::endl;
- else std::cout<<"Sorry, this is not Palindrome!"<<std::endl;
- return 0;
- }
Add Comment
Please, Sign In to add comment