Big Integer Addition (arbitrary precision)

VERY HARD · C · 5000ms

For the closing challenge, two students exchange enormous made-up ID numbers, far too big for any built-in integer type, and want to know their sum without a calculator. Read two non-negative integers A and B given as strings (they may have up to 200 digits — far beyond what fits in any built-in integer type). Print A+B as a string, computed via manual digit-by-digit addition with carry, without using any big-integer library.

Input

Two strings A and B (digits only) on two lines.

Output

A string: the sum, no leading zeros (unless the sum is 0).

Constraints

1 ≤ |A|,|B| ≤ 200

Sample Input

99999999999999999999
1

Sample Output

100000000000000000000
main.c
Loading editor…

Write C, then Run (custom I/O) or Submit (sample tests). ⌘/Ctrl+Enter submits.

Big Integer Addition (arbitrary precision) · DIU ContestHub