Solution for CCC '13 J2 - Rotating letters in Java 8


Nov. 5, 2019 1.294714 seconds Java 8
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");
            }
        
    }
}

Editorial


No editorial for this problem. :(

Original Problem


You can view the original page for this problem on the DMOJ.