import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException {
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
StringBuffer sb = new StringBuffer("");
String m;
while(true){
m=br.readLine();
if("DONE".equals(m)){
break;
}
m=m.toLowerCase();
StringBuilder temp=new StringBuilder("");
for(int i=0;i<m.length();i++){
if(m.charAt(i)>96 && m.charAt(i)<123){
temp.append(m.charAt(i));
}
}
if(pali(temp.toString()))
sb.append("You won't be eaten!\n");
else
sb.append("Uh oh..\n");
}
System.out.print(sb);
}
static boolean pali(String s) {
for (int i = 0, j = s.length() - 1; i < s.length() / 2; i++, j--) {
if (s.charAt(i) != s.charAt(j)) {
return false;
}
}
return true;
}
}
Accepted ;)
ReplyDelete