(1).백준 11319번 Count Me In는 간단하게 자음, 모음의 숫자를 출력해야 하는 문제로

map에 담아서 비교할 수 있게 한 다음

간단히 비교할 수 있게 toLowerCase로 소문자로 변경해주고

비교 후 모음이 아니면 자음을 카운팅하는 방식으로 처리해서 출력했다.

const vowel = {
    'a' : 1,
    'e' : 1,
    'i' : 1,
    'o' : 1,
    'u' : 1
}

for(let i = 1 ; i < input.length ; i++){
    const str = input[i].split(' ').join('').toLowerCase()
    let vowelCount = 0
    let consonantCount = 0

    for(let j = 0 ; j < str.length ; j++){
        if(vowel[str[j]]){
            vowelCount++
        }
        else{
            consonantCount++
        }
    }
    console.log(consonantCount, vowelCount)
}

'회고' 카테고리의 다른 글

[개발일지] - 762  (0) 2025.08.04
[개발일지] - 761(주말)  (0) 2025.08.03
[개발일지] - 759  (1) 2025.08.01
[개발일지] - 758  (0) 2025.07.31
[개발일지] - 757  (1) 2025.07.30

+ Recent posts