package yukicoder; import java.io.UnsupportedEncodingException; import java.util.HashSet; import java.util.Scanner; import java.util.Set; public class Main{ public static void main(String[] args) { new Main().solver(); } Set lowcase = new HashSet<>(); Set nonsymbol = new HashSet<>(); byte[] digi; byte[] petit; byte[] gema; byte[] piyo; @SuppressWarnings("unchecked") void solver() { byte[] d = null; try { d = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789".getBytes("US-ASCII"); digi = "nyo".getBytes("US-ASCII"); petit = "nyu".getBytes("US-ASCII"); gema = "gema".getBytes("US-ASCII"); piyo = "pyo".getBytes("US-ASCII"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } for (int i = 0; i < d.length; i++) { nonsymbol.add(d[i]); } Scanner sc = new Scanner(System.in); while (sc.hasNext()) { String line = sc.nextLine(); if (isCorrect(line)) { System.out.println("CORRECT (maybe)"); } else { System.out.println("WRONG!"); } } } String[] name = { "digi", "petit", "rabi", "gema", "piyo" }; boolean isCorrect(String line) { int num = -1; out:for (int i = 0; i < 5; i++) { for (int j = 0;j= 0 && j < len - i; j++) { f = true; if (bottom[j - (len - 1) + (n - 1) + i] != code[j]) { f = false; break; } } for (int j = len - i; j >= 0 && j < len; j++) { if (nonsymbol.contains(code[j])) { f = false; break; } } if (f) { return true; } } return false; } }