Skip to content

Commit

Permalink
CT_309
Browse files Browse the repository at this point in the history
  • Loading branch information
Jade-Good committed Nov 14, 2024
1 parent a905f5f commit 9e7dc64
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions BOJ/Java/src/B2/Boj_18245_이상한나라의암호.java
Original file line number Diff line number Diff line change
@@ -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();
}
}

0 comments on commit 9e7dc64

Please sign in to comment.