T-coding
백준 4659 비밀번호 발음하기 / Python 본문
728x90
728x90
https://www.acmicpc.net/problem/4659
풀이
더보기
vowel = ['a', 'e', 'i', 'o', 'u']
while True:
s = input()
if s == "end":
break
v_cnt = 0
v_repeat, c_repeat = 0, 0
last = ''
flag = True
for i in s:
if i in vowel:
if v_repeat == 2 or ((i != 'e' and i != 'o') and last == i):
flag = False
break
else:
v_repeat += 1
c_repeat = 0
v_cnt += 1
last = i
else:
if c_repeat == 2 or last == i:
flag = False
break
else:
c_repeat += 1
v_repeat = 0
last = i
if v_cnt == 0:
flag = False
if flag:
print("<{}> is acceptable.".format(s))
else:
print("<{}> is not acceptable.".format(s))
728x90
300x250
'Baekjoon' 카테고리의 다른 글
백준 25206 너의 평점은 / Python (0) | 2023.03.16 |
---|---|
백준 5347 LCM / Python (0) | 2023.03.16 |
백준 1107 리모컨 / C++ (0) | 2022.11.30 |
백준 1188 음식 평론가 / C++ (0) | 2022.11.30 |
백준 1662 압축 / C++ (0) | 2022.11.30 |