- import java.util.*;
- /**
- *
- * @author tunzao
- * @version 1.0 May 6, 2011
- *
- */
- public class Palindromes
- {
- public static void main(String[] args)
- {
- Scanner in = new Scanner(System.in);
- while(in.hasNext())
- {
- String s = in.nextLine();
- if (s.length() == 0)
- break;
- char[] ch = s.toCharArray();
- boolean isPal = true;
- boolean isMirror = true;
- for (int i = 0, j = ch.length-1; i < j; i++, j--)
- {
- if (ch[i] != ch[j])
- {
- isPal = false;
- if (ch[i] != getReverseChar(ch[j]))
- {
- isMirror = false;
- break;
- }
- }
- }
- if (!isPal && !isMirror)
- System.out.println(s + " -- is not a palindrome.");
- else if (isPal && !isMirror)
- System.out.println(s + " -- is a regular palindrome.");
- else if (!isPal && isMirror)
- System.out.println(s + " -- is a mirrored string.");
- else
- System.out.println(s + " -- is a mirrored palindrome.");
- }
- in.close();
- //System.exit(0);
- }
- private static char getReverseChar(char c)
- {
- switch (c)
- {
- case 'A':
- return 'A';
- case 'E':
- return '3';
- case 'H':
- return 'H';
- case 'I':
- return 'I';
- case 'J':
- return 'L';
- case 'L':
- return 'J';
- case 'M':
- return 'M';
- case 'O':
- return 'O';
- case 'S':
- return '2';
- case 'T':
- return 'T';
- case 'U':
- return 'U';
- case 'W':
- return 'W';
- case 'X':
- return 'X';
- case 'Y':
- return 'Y';
- case 'Z':
- return '5';
- case '1':
- return '1';
- case '2':
- return 'S';
- case '3':
- return 'E';
- case '5':
- return 'Z';
- case '8':
- return '8';
- default:
- return 0;
- }
- }
- }