알고리즘/백준
[백준/26314번] Vowel Count - B3/Python
SangJunni
2024. 4. 7. 20:58
26314번: Vowel Count
The first input line contains a positive integer, n, indicating the number of names to check. The names are on the following n input lines, one name per line. Each name starts in column 1 and consists of 1-20 lowercase letters (assume the name will not con
www.acmicpc.net
문제
오루지 박사는 자신의 이름에 자음보다 모음이 더 많다는 사실을 알아냈습니다. 그는 자신과 같은 사람을 만나는 것을 좋아하기 때문에 그러한 이름을 식별하는 데 도움이 되는 프로그램을 작성해 달라고 요청했습니다.
이름이 주어지면 자음보다 모음이 더 많은지 확인하세요. 모음은 "aeiou"라고 가정합니다.
입력
n
n개의 이름
풀이
n = int(input())
vowel = ['a','e', 'i', 'o', 'u']
for _ in range(n):
word = input()
v,nv = 0,0
for w in word:
if w in vowel:
v += 1
else:
nv += 1
print(word)
if v > nv:
print(1)
else:
print(0)
해결방법
각 이름 별로 자음 모음 수를 센 다음 각 이름을 출력하고 모음이 많은 경우 1을 출력하고 아닌 경우 0을 출력