알고리즘

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

HHB 2023. 10. 7. 18:48
def solution(babbling):
    answer = 0
    
    talk = ["aya", "ye", "woo", "ma"]
    for t in babbling:
        for c in talk:
            if c * 2 not in t:
                t = t.replace(c, ' ')
            
        if len(t.strip()) == 0:
            answer += 1
            
        print(t)
            
    return answer
728x90
반응형
LIST