import java.util.Scanner; import java.io.IOException; import java.util.regex.Pattern; import java.util.regex.Matcher;; public class Main { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); String[] name = {"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})$"; String C = "CORRECT (maybe)"; String W = "WRONG!"; boolean flag = false; while(sc.hasNextLine()){ String line = sc.nextLine(); if(line.indexOf(' ') == -1){ System.out.println(W); continue; } String sub = line.split(" ",2)[0]; for(int i=0; i<5; i++){ if(sub.equals(name[i])){ flag = true; Pattern p = Pattern.compile(check[i]); Matcher m = p.matcher(line); boolean b = m.matches(); if(b){ System.out.println(C); break; }else{ System.out.println(W); break; } } } if(!flag){ System.out.println(W); } } sc.close(); System.out.flush(); } }