1. 


/**
* Angewandte Mathematik, SS09, IFB 2C
* ACM Problem #401 - Palindromes
* Link: http://icpcres.ecs.baylor.edu/onlinejudge/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=6&problem=342&mosmsg=Submission+received+with+ID+7072078
*
* @author Christoph Miesel
* @author Andre Wolfram
* @author Robert Seilbeck
* @version 1.789, 04/15/2009
*
* Status : Accepted
* Runtime 0.430
*/


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(
System.in));
String line;
//Tabelle aus Aufgabe
char reverted[][] = new char[][] { { 'A', 'A' }, { 'E', '3' },
{ 'H', 'H' }, { 'I', 'I' }, { 'J', 'L' }, { 'M', 'M' },
{ 'O', 'O' }, { 'T', 'T' }, { 'U', 'U' }, { 'V', 'V' },
{ 'W', 'W' }, { 'X', 'X' }, { 'Y', 'Y' }, { 'Z', '5' },
{ '1', '1' }, { '2', 'S' }, { '3', 'E' }, { '5', 'Z' },
{ '8', '8' },{'S','2'},{'L','J'} };
while ((line = reader.readLine()) != null) {
//├�berpr├╝ft ob es sich um ein Palindrom handelt
boolean palino = true;
int startIndex = 0;
int endIndex = line.length() - 1;
while (startIndex < endIndex) {
if (line.charAt(startIndex) != line.charAt(endIndex)) {
palino = false;
break;
}
startIndex++;
endIndex--;
}

//├�berpr├╝ft ob es sich um ein gespiegeltes wort handelt
boolean mirrored = true;
startIndex = 0;
endIndex = line.length() - 1;
while (startIndex <= endIndex) {
boolean found = false;
for (int i = 0; i < reverted.length; i++) {
if (line.charAt(startIndex) == reverted[i][0]) {
found = true;
if (line.charAt(endIndex) != reverted[i][1]) {
mirrored = false;
break;
}
}
}
if (!found) {
mirrored = false;
break;
}
startIndex++;
endIndex--;
}
//├�berpr├╝ft die mitte des Wortes bei ungerader Buchstabenanzahl
if (startIndex == endIndex) {
boolean found = false;
for (int i = 0; i < reverted.length; i++) {
if (line.charAt(startIndex) == reverted[i][0]) {
found = true;
}
}
if (!found) {
mirrored = false;
}
}
//Ausgabe
if (!palino && !mirrored) {
System.out.println(line + " -- is not a palindrome.");
} else if (palino && !mirrored) {
System.out.println(line + " -- is a regular palindrome.");
} else if (!palino && mirrored) {
System.out.println(line + " -- is a mirrored string.");
} else {
System.out.println(line + " -- is a mirrored palindrome.");
}
System.out.println();
}
}

}

2.


/* Angewandte Mathematik, SS09, IFB 2C
* ACM Problem #401 (Palindromes)
* Link: http://icpcres.ecs.baylor.edu/onlinejudge/index.php?option=com_onlinejudge&Itemid=8&category=6&page=show_problem&problem=342
*
* @author Dennis Wilfert
* @author Johann Studt
* @version 1.0, 04/15/2009
*
* Status : Accepted
* Runtime: 0.550
*/
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;


public class Main {

public static void main(String[] args) {


BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

Scanner scanner = new Scanner(reader);
String str;
// Hilfsvariable um festzustellen ob es sich um ein Palindrome handelt
boolean palindrome;
// Hilfsvariable um festzustellen ob es sich um ein Mirrored Palindrom handelt
boolean mirrored;
// Hilfsvariable um festzustellen ob es sich um ein Mirrored String handelt
boolean mstring;
// Chars des String speichern
char [] charstring;
// Lńnge des Arrays
int length;

while(scanner.hasNext())
{
str = scanner.next();
charstring = str.toCharArray();
palindrome = true;
mirrored = true;
mstring = false;
length = charstring.length;

// Feststellen ob es sich um ein Palindrom handelt
for(int i = 0; i < length/2+1; i++)
{
if(charstring[i]!= charstring[length-i-1])
{
palindrome = false;
break;
}
}

// Feststellen ob es sich um ein Mirrored Palindrom handelt
if(palindrome)
{
for(int i = 0; i < length/2+1; i++)
{
switch(charstring[i]){
case 'B':
mirrored = false;
break;
case 'C':
mirrored = false;
break;
case 'D':
mirrored = false;
break;
case 'E':
mirrored = false;
break;
case 'F':
mirrored = false;
break;
case 'G':
mirrored = false;
break;
case 'J':
mirrored = false;
break;
case 'K':
mirrored = false;
break;
case 'L':
mirrored = false;
break;
case 'N':
mirrored = false;
break;
case 'P':
mirrored = false;
break;
case 'Q':
mirrored = false;
break;
case 'R':
mirrored = false;
break;
case 'S':
mirrored = false;
break;
case 'Z':
mirrored = false;
break;
case '2':
mirrored = false;
break;
case '3':
mirrored = false;
break;
case '4':
mirrored = false;
break;
case '5':
mirrored = false;
break;
case '6':
mirrored = false;
break;
case '7':
mirrored = false;
break;
case '9':
mirrored = false;
break;
}
if(!mirrored)
break;

}
}

// Feststellen ob es sich um einen Mirrored String handelt
if(!palindrome)
{
for(int i = 0 ; i < length/2+1; i++)
{
switch(charstring[i])
{
case 'A':
if(charstring[length-i-1] == 'A' )
mstring = true;
break;
case 'E':
if(charstring[length-i-1] == '3' )
mstring = true;
break;
case 'H':
if(charstring[length-i-1] == 'H' )
mstring = true;
break;
case 'I':
if(charstring[length-i-1] == 'I' )
mstring = true;
break;
case 'J':
if(charstring[length-i-1] == 'L' )
mstring = true;
break;
case 'L':
if(charstring[length-i-1] == 'J' )
mstring = true;
break;
case 'M':
if(charstring[length-i-1] == 'M' )
mstring = true;
break;
case 'O':
if(charstring[length-i-1] == 'O' )
mstring = true;
break;
case 'S':
if(charstring[length-i-1] == '2' )
mstring = true;
break;
case 'T':
if(charstring[length-i-1] == 'T' )
mstring = true;
break;
case 'U':
if(charstring[length-i-1] == 'U' )
mstring = true;
break;
case 'V':
if(charstring[length-i-1] == 'V' )
mstring = true;
break;
case 'W':
if(charstring[length-i-1] == 'W' )
mstring = true;
break;
case 'X':
if(charstring[length-i-1] == 'X' )
mstring = true;
break;
case 'Y':
if(charstring[length-i-1] == 'Y' )
mstring = true;
break;
case 'Z':
if(charstring[length-i-1] == '5' )
mstring = true;
break;
case '1':
if(charstring[length-i-1] == '1' )
mstring = true;
break;
case '2':
if(charstring[length-i-1] == 'S' )
mstring = true;
break;
case '3':
if(charstring[length-i-1] == 'E' )
mstring = true;
break;
case '5':
if(charstring[length-i-1] == 'Z' )
mstring = true;
break;
case '8':
if(charstring[length-i-1] == '8' )
mstring = true;
break;
}
}

}

if(palindrome)
{
if(mirrored)System.out.println(str + " -- is a mirrored palindrome.");
else
System.out.println(str + " -- is a regular palindrome.");
}
else
{
if(mstring)System.out.println(str + " -- is a mirrored string.");
else System.out.println(str + " -- is not a palindrome.");
}


System.out.println();
}


}

}