50% 가량에서 틀렸다.
나의 경우 이유는 출력 형식 이였다.
if isGather and flag == True:
print("<", target_txt, "> is acceptable.")
else:
print("<", target_txt, "> is not acceptable." )
출력을 위와 같이 작성했더니 파이썬에서 자동으로 띄어 쓰기를 넣어 주었다.
그래서 아래와 같은 형식으로 출력이 나와서 틀렸다.
< houctuh > is acceptable.
gather = ['a', 'e', 'i', 'o', 'u']
while True:
isGather = False
flag = True
target_txt = input()
if target_txt == "end":
break
for i in range(len(target_txt)):
if target_txt[i] in gather:
isGather = True
if i>= 2:
if target_txt[i] in gather and target_txt[i-1] in gather and target_txt[i-2] in gather:
flag = False
break
elif target_txt[i] not in gather and target_txt[i-1] not in gather and target_txt[i-2] not in gather:
flag = False
break
if i >= 1 and target_txt[i] == target_txt[i-1] :
if target_txt[i] == 'e' or target_txt[i] =='o':
continue
else :
flag = False
break
if isGather and flag == True:
print("<"+ target_txt+ "> is acceptable.",sep="")
else:
print("<"+ target_txt+ "> is not acceptable.",sep="" )
'백준' 카테고리의 다른 글
[백준 25757] 임스와 함께하는 미니게임 python(시간초과) (0) | 2023.01.04 |
---|---|
[백준 13549] 숨바꼭질 3 (python) 우선순위 큐를 이용한 구현 (0) | 2023.01.02 |
[백준 20055] 컨베이어 벨트 위의 로봇(python) deque 이용 구현 (0) | 2023.01.01 |
[백준 3190] 뱀 python (tc5 tc6 틀림) (3) | 2022.12.23 |
[백준 9205] 맥주 마시면서 걸어가기 python (0) | 2022.12.21 |