package レベル1; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.UncheckedIOException; import java.util.stream.Stream; class Main { public static void main(String[] args) { no18(); } // No.18 うーさー暗号 private static void no18() { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); // 入力値 String input = ""; char[] alphabet = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' }; try { input = reader.readLine(); reader.close(); } catch (IOException e) { throw new UncheckedIOException(e); } char[] inputs = input.toCharArray(); StringBuilder output = new StringBuilder(); for (int i = 0, j = 1; i < inputs.length; i++, j++) { if (i % 26 == 0) { j = 1; } for (int k = 0; k < alphabet.length; k++) { if (alphabet[k] == inputs[i]) { if (k - j < 0) { output.append(alphabet[26 - j + k]); } else { output.append(alphabet[k - j]); } } } } System.out.println(output.toString()); } }