JavaAlgorithm

프로그래머스 암호해독 (자바)

MyDiaryYo 2023. 11. 30. 14:58

 

 

 

 

public static void main(String[] args) {

//        String cipher = "pfqallllabwaoclk";
//        int code = 2;

        String cipher = "dfjardstddetckdaccccdegk";
        int code = 4;
        String answer = "";

        for(int i=1; i<=(cipher.length()/code); i++) {
            answer += cipher.charAt((i*code)-1);
        }
        System.out.println(answer.toString());
    }