import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String names[] = {"digi","petit","rabi","gema","piyo"}; String check[] = new String[5]; check[0] = "digi .*[nN][yY][oO][^a-zA-Z0-9]{0,3}"; check[1] = "petit .*[nN][yY][uU][^a-zA-Z0-9]{0,3}"; check[2] = "rabi [a-zA-Z0-9].*"; check[3] = "gema .*[gG][eE][mM][aA][^a-zA-Z0-9]{0,3}"; check[4] = "piyo .*[pP][yY][oO][^a-zA-Z0-9]{0,3}"; boolean flag = false; while(sc.hasNextLine()){ String line = sc.nextLine(); String[] name = line.split(" ",2); if(name[0].length() == -1){ System.out.println("WRONG!"); continue; } for(int i=0; i<5; i++){ if(name[0].matches(names[i])){ flag = true; if(line.matches(check[i])){ System.out.println("CORRECT (maybe)"); }else{ System.out.println("WRONG!"); } } } if(!flag){ System.out.println("WRONG!"); continue; } flag = false; } } }