본문 바로가기
python-algorithm

백준 18409 母音を数える (Counting Vowels)

by 무적김두칠 2022. 12. 21.

https://www.acmicpc.net/problem/18409

 

18409번: 母音を数える (Counting Vowels)

長さ N の英小文字からなる文字列 S が与えられる.S のうち母音字の個数,つまり a,i,u,e,o の個数の総和を求めよ.

www.acmicpc.net

 

1
2
3
4
5
6
7
8
9
10
11
def sol(s):
    answer = 0
    vowels = ['a','e','i','o','u']
    for vowel in vowels:
        answer+=s.count(vowel)
    return answer
 
if __name__ == '__main__':
    len_s = int(input())
    s = input()
    print(sol(s))
cs
반응형

'python-algorithm' 카테고리의 다른 글

백준 21335 Another Eruption  (0) 2022.12.21
백준 20215 Cutting Corners  (0) 2022.12.21
백준 20352 Circus  (0) 2022.12.20
백준 15128 Congruent Numbers  (0) 2022.12.20
백준 24860 Counting Antibodies  (0) 2022.12.20

댓글