CCC '13 J2 - Rotating letters
Source Code
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
String a = in.next();
boolean flag = false;
for(int i = 0; i < a.length(); i++){
//I, O, S, H, Z, X, and N.
if(a.charAt(i) == 'I'){
}else if(a.charAt(i) == 'O'){
}else if(a.charAt(i) == 'S'){
}else if(a.charAt(i) == 'H'){
}else if(a.charAt(i) == 'Z'){
}else if(a.charAt(i) == 'X'){
}else if(a.charAt(i) == 'N'){
}else{
flag = true;
}
}
if(flag){
System.out.println("NO");
}else{
System.out.println("YES");
}
}
}