#include<iostream>
#include<algorithm>
#include<sstream>
#include<fstream>
#include<utility>
#include<cstdlib>
#include<cstring>
#include<string>
#include<bitset>
#include<vector>
#include<cstdio>
#include<cctype>
#include<cmath>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#define mx 10077
using namespace std;
int main(){
char memory[mx];
string s, x, y;
int i;
memset(memory, 0, s.size());
memory['A'] = 'A';
memory['E'] = '3';
memory['H'] = 'H';
memory['I'] = 'I';
memory['J'] = 'L';
memory['L'] = 'J';
memory['M'] = 'M';
memory['O'] = 'O';
memory['S'] = '2';
memory['T'] = 'T';
memory['U'] = 'U';
memory['V'] = 'V';
memory['W'] = 'W';
memory['X'] = 'X';
memory['Y'] = 'Y';
memory['Z'] = '5';
memory['1'] = '1';
memory['2'] = 'S';
memory['3'] = 'E';
memory['5'] = 'Z';
memory['8'] = '8';
while(cin >> s){
x = "";
y = "";
for(i = s.size() - 1; i >= 0; i--){
x = x + s[i];
y = y + memory[s[i]];
}
if(s == x && s != y)
cout << s << " -- is a regular palindrome." << endl << endl;
else if(s != x && s == y)
cout << s << " -- is a mirrored string." << endl << endl;
else if(s == x && s == y)
cout << s << " -- is a mirrored palindrome." << endl << endl;
else
cout << s << " -- is not a palindrome." << endl << endl;
}
return 0;
}
#include<algorithm>
#include<sstream>
#include<fstream>
#include<utility>
#include<cstdlib>
#include<cstring>
#include<string>
#include<bitset>
#include<vector>
#include<cstdio>
#include<cctype>
#include<cmath>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#define mx 10077
using namespace std;
int main(){
char memory[mx];
string s, x, y;
int i;
memset(memory, 0, s.size());
memory['A'] = 'A';
memory['E'] = '3';
memory['H'] = 'H';
memory['I'] = 'I';
memory['J'] = 'L';
memory['L'] = 'J';
memory['M'] = 'M';
memory['O'] = 'O';
memory['S'] = '2';
memory['T'] = 'T';
memory['U'] = 'U';
memory['V'] = 'V';
memory['W'] = 'W';
memory['X'] = 'X';
memory['Y'] = 'Y';
memory['Z'] = '5';
memory['1'] = '1';
memory['2'] = 'S';
memory['3'] = 'E';
memory['5'] = 'Z';
memory['8'] = '8';
while(cin >> s){
x = "";
y = "";
for(i = s.size() - 1; i >= 0; i--){
x = x + s[i];
y = y + memory[s[i]];
}
if(s == x && s != y)
cout << s << " -- is a regular palindrome." << endl << endl;
else if(s != x && s == y)
cout << s << " -- is a mirrored string." << endl << endl;
else if(s == x && s == y)
cout << s << " -- is a mirrored palindrome." << endl << endl;
else
cout << s << " -- is not a palindrome." << endl << endl;
}
return 0;
}
No comments:
Post a Comment