프로그래머스: 옹알이(2)

김아무개·2023년 3월 31일
0

프로그래머스

목록 보기
22/41

내 코드

class Solution {
    public int solution(String[] babbling) {
        int answer = 0;
        String[] words = {"aya", "ye", "woo", "ma"};
        for (String b: babbling) {
            for (String word: words) {
                if (!b.contains(word + word)) b = b.replace(word, " ");
            }
            if ("".equals(b.replace(" ", ""))) answer++;
        }
        
        return answer;
    }
}


처음 풀어본 날짜 : 23.03.31
다시 풀어본 날짜 : 23.04.01 _ 23.04.02

profile
Hello velog! 

0개의 댓글