class Solution {
public String solution(String cipher, int code) {
String answer = "";
return answer;
}
}
해결법
방법 1
class Solution {
public String solution(String cipher, int code) {
String answer = "";
for (int i = code-1; i < cipher.length(); i+=code) {
answer += cipher.charAt(i);
}
return answer;
}
}
방법 2
class Solution {
public String solution(String cipher, int code) {
String answer = "";
for (int i = code; i <= cipher.length(); i+=code) {
answer += cipher.substring(i - 1, i);
}
return answer;
}
}
암호 해독 Lv. 0