From 9e7dc64920f826eabc048397cc9605a0734d8e62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EC=88=98=EB=AF=BC?= Date: Thu, 14 Nov 2024 10:16:22 +0900 Subject: [PATCH] CT_309 --- ...\354\235\230\354\225\224\355\230\270.java" | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 "BOJ/Java/src/B2/Boj_18245_\354\235\264\354\203\201\355\225\234\353\202\230\353\235\274\354\235\230\354\225\224\355\230\270.java" diff --git "a/BOJ/Java/src/B2/Boj_18245_\354\235\264\354\203\201\355\225\234\353\202\230\353\235\274\354\235\230\354\225\224\355\230\270.java" "b/BOJ/Java/src/B2/Boj_18245_\354\235\264\354\203\201\355\225\234\353\202\230\353\235\274\354\235\230\354\225\224\355\230\270.java" new file mode 100644 index 00000000..8126a33b --- /dev/null +++ "b/BOJ/Java/src/B2/Boj_18245_\354\235\264\354\203\201\355\225\234\353\202\230\353\235\274\354\235\230\354\225\224\355\230\270.java" @@ -0,0 +1,30 @@ +package B2; + +import java.io.*; + +public class Boj_18245_이상한나라의암호 { + public static void main(String[] args) throws IOException { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); + StringBuilder sb = new StringBuilder(); + + String s; + int i = 2; + + while(!(s = br.readLine()).equals("Was it a cat I saw?")) { + + char[] chars = s.toCharArray(); + + for (int j = 0; j < chars.length; j+=i) { + sb.append(chars[j]); + } + + sb.append('\n'); + + i++; + } + + bw.write(sb.toString()); + bw.flush(); + } +}