1 #include2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 using namespace std;11 12 string msgList[4] { "not a palindrome.","a regular palindrome.","a mirrored string.","a mirrored palindrome."};13 string reverseList = { "A 3 HIL JM O 2TUVWXY51SE Z 8 "};14 int main()15 {16 string input;17 while(cin >> input)18 {19 int isPalindrome = 1,isMirrored = 1;20 int lo,hi;21 for(lo = 0,hi = input.size()-1; lo < hi; lo ++,hi --)22 {23 if(input[lo]!=input[hi])24 {25 isPalindrome = 0;26 break;27 }28 }29 30 for(lo = 0,hi = input.size()-1; lo <= hi; lo ++,hi --)31 {32 if(isalpha(input[lo]))33 { 34 if(reverseList[input[lo]-'A'] != input[hi])35 {36 isMirrored = 0;37 break;38 }39 } 40 else41 { 42 if(reverseList[input[lo]-'0'+25] != input[hi])43 {44 isMirrored = 0;45 break;46 }47 } 48 }49 cout << input << " -- is " << msgList[isMirrored*2+isPalindrome] << endl << endl;50 }51 return 0;52 }