본문 바로가기
Beakjoon&프로그래머스/파이썬

[백준/파이썬] 8949번 대충 더해

by 현장 2022. 7. 2.

-Code

a, b = input().split()
a, b = a[::-1], b[::-1]
if len(b) > len(a):
    a, b = b, a
res = []

for i in range(len(a)):
    if i < len(b):
        res.append(str(int(a[i]) + int(b[i])))
    else:
        res.append(a[i])
print(*res[::-1], sep='')