# 실패코드
input_list = []
while True:
input_str = input()
if input_str == '':
break
input_list.append(input_str)
for i in input_list:
print(i, end = '\n')
처음에 문제를 받았을 때 문자열이 어디에서 끝나는지 모르겠는 문제가 나왔습니다.
while True:
try:
print(input())
except EOFError:
break
이를 try except로 예외 처리하는 방법을 사용하였습니다.
'알고리즘 > 문자열(string)' 카테고리의 다른 글
백준 5622 python (0) | 2023.06.14 |
---|---|
백준 10809 python (0) | 2023.06.14 |