zoj_1325

2208 ワード

悲劇だ...ますます疲れてきた...早く9時半まで.の私は寮に帰って熱いシャワーを浴びます.ああ..
/*
zoj_1325         
   ,        。。。
*/
#include <iostream>
#include <map>
using namespace std;
map <char,char>mymap;

string pa( string t )
{
    string tt="";
    int i;
    for( i=t.size()-1;i>=0;i-- )
        tt+=t[i];
    return tt;
}

string mirro( string t )
{
    string tt="";
    int i;
    for( i=t.size()-1;i>=0;i-- )
        tt+=mymap[ t[i] ];
    return tt;
}

int main()
{
    mymap['A']='A'; mymap['J']='L'; mymap['S']='2'; mymap['2']='S';
    mymap['B']=' '; mymap['K']=' '; mymap['T']='T'; mymap['3']='E';
    mymap['C']=' '; mymap['L']='J'; mymap['U']='U'; mymap['4']=' ';
    mymap['D']=' '; mymap['M']='M'; mymap['V']='V'; mymap['5']='Z';
    mymap['E']='3'; mymap['N']=' '; mymap['W']='W'; mymap['6']=' ';
    mymap['F']=' '; mymap['O']='O'; mymap['X']='X'; mymap['7']=' ';
    mymap['G']=' '; mymap['P']=' '; mymap['Y']='Y'; mymap['8']='8';
    mymap['H']='H'; mymap['Q']=' '; mymap['Z']='5'; mymap['9']=' ';
    mymap['I']='I'; mymap['R']=' '; mymap['1']='1'; mymap['0']='0';
    string t;
    while( cin>>t )
    {
        if( pa(t)==t && mirro(t)==t )
            cout<<t<<" -- is a mirrored palindrome.
"; else if( pa(t)==t ) cout<<t<<" -- is a regular palindrome.
"; else if( mirro(t)==t ) cout<<t<<" -- is a mirrored string.
"; else cout<<t<<" -- is not a palindrome.
"; cout<<endl; } return 0; }