← 返回 bytedance 的题目列表Add Strings (character array variant)
类型:online_judge
Problem: Add two big integers represented as character arrays (Add Strings variant)
You are given two character arrays a and b, each representing a non-negative integer in base-10 from left to right (e.g. ['1','2','3'] represents 123).
Compute the sum of the two numbers and output its decimal representation.
Requirements
You must not convert the entire input directly into an integer type (e.g. using int() in Python).
Perform digit-by-digit addition with carry.
Input Format
Line 1: a string (no spaces) representing character array a
Line 2: a string (no spaces) representing character array b
Note: for convenience, the character arrays are provided as plain strings.
Output Format
Output one line: a string representing a + b.
Constraints
1 <= len(a), len(b) <= 1e5
a and b contain only '0'..'9'
No leading zeros unless the number is exactly 0
Examples
Example 1
Input:
123
77
Output:
200
Example 2
Input:
0
0
Output:
0
Example
Input
123
77
Output
200