N = int(input())
cons_list = list()
for j in range(0, N):
sum_as = 0
for i in str(j):
sum_as += int(i)
if sum_as + j == N:
cons_list.append(j)
if len(cons_list) == 0:
print(0)
else:
print(min(cons_list))
참고
1. list() : list를 생성 2. str() : 매개변수를 문자열로 치환 3. int() : 매개변수를 숫자로 치환 4. len() : 길이 반환 5. list.append(e) : list 가장 뒤에 값 추가 6. min() : 최솟값 반환