#include<bits/stdc++.h>
using namespace std;
map<char, char>a;
int main()
{
int i;
a['A'] = 'A';
a['E'] = '3';
a['H'] = 'H';
a['I'] = 'I';
a['J'] = 'L';
a['L'] = 'J';
a['M'] = 'M';
a['O'] = 'O';
a['S'] = '2';
a['T'] = 'T';
a['U'] = 'U';
a['V'] = 'V';
a['W'] = 'W';
a['X'] = 'X';
a['Y'] = 'Y';
a['Z'] = '5';
a['0'] = 'O';
a['1'] = '1';
a['2'] = 'S';
a['3'] = 'E';
a['5'] = 'Z';
a['8'] = '8';
string s;
while(cin >> s)
{
string t = s;
int p = 0, m = 0;
reverse(t.begin(), t.end());
if(t == s)
p = 1;
string r;
for(i=0;i<s.size();i++)
{
char ch = s[i];
r.push_back(a[ch]);
}
reverse(r.begin(), r.end());
if(r == s)
m = 1;
if(p == 0 && m == 0)
cout << s << " -- is not a palindrome." << endl;
else if(p == 1 && m == 0)
cout << s << " -- is a regular palindrome." << endl;
else if(p == 0 && m == 1)
cout << s << " -- is a mirrored string." << endl;
else if(p == 1 && m == 1)
cout << s << " -- is a mirrored palindrome." << endl;
cout << endl;
}
return 0;
}
using namespace std;
map<char, char>a;
int main()
{
int i;
a['A'] = 'A';
a['E'] = '3';
a['H'] = 'H';
a['I'] = 'I';
a['J'] = 'L';
a['L'] = 'J';
a['M'] = 'M';
a['O'] = 'O';
a['S'] = '2';
a['T'] = 'T';
a['U'] = 'U';
a['V'] = 'V';
a['W'] = 'W';
a['X'] = 'X';
a['Y'] = 'Y';
a['Z'] = '5';
a['0'] = 'O';
a['1'] = '1';
a['2'] = 'S';
a['3'] = 'E';
a['5'] = 'Z';
a['8'] = '8';
string s;
while(cin >> s)
{
string t = s;
int p = 0, m = 0;
reverse(t.begin(), t.end());
if(t == s)
p = 1;
string r;
for(i=0;i<s.size();i++)
{
char ch = s[i];
r.push_back(a[ch]);
}
reverse(r.begin(), r.end());
if(r == s)
m = 1;
if(p == 0 && m == 0)
cout << s << " -- is not a palindrome." << endl;
else if(p == 1 && m == 0)
cout << s << " -- is a regular palindrome." << endl;
else if(p == 0 && m == 1)
cout << s << " -- is a mirrored string." << endl;
else if(p == 1 && m == 1)
cout << s << " -- is a mirrored palindrome." << endl;
cout << endl;
}
return 0;
}
Comments
Post a Comment