n1k1t0s

Untitled

Sep 30th, 2018
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.85 KB | None | 0 0
  1. int main13()
  2. {
  3.     std::string a;
  4.     bool q,p,p1,p2,t;
  5.     std::cout<<"Input word"<<std::endl;
  6.     std::cin>>a;
  7.     if (a.length()!=7){
  8.         std::cout<<"ERROR:: Input 7-letter word!!!"<<std::endl;
  9.         std::cin>>a;
  10.     }
  11.     p1 = ((a[0]>64) && (a[1]>64) && (a[2]>64) && (a[4]>64) && (a[5]>64) && (a[6]>64));
  12.     p2 = ((a[0]<123) && (a[1]<123) && (a[2]<123) && (a[4]<123) && (a[5]<123) && (a[6]<123));
  13.     p = p1 && p2;
  14.     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)));
  15.     t = ((a[0]==a[6]) && (a[1]==a[5]) && (a[2]==a[4]));
  16.     if (t) std::cout<<"This is Palindrome!"<<std::endl;
  17.     else if (q && p) std::cout<<"This is Palindrome, but letters are in different registers!"<<std::endl;
  18.     else std::cout<<"Sorry, this is not Palindrome!"<<std::endl;
  19.     return 0;
  20. }
Add Comment
Please, Sign In to add comment