Output two given positive integers after removing every digit 0, then also remove any leading zeros from the resulting numbers.
Problem
You are given two positive integers and . Your task is to imagine a modified representation of each number where every digit 0 is removed.
After removing all zeros, interpret the remaining digits as a decimal integer again. The two resulting integers should then be added together, and the sum should be printed.
Important note
If removing zeros creates leading zeros in the remaining digit sequence, they do not affect the numeric value.
Preptin rephrasing
Write a program that:
- Reads two integers.
- Deletes all
0digits from each integer independently. - Treats the remaining digits as integers.
- Prints the sum of those two values.
Input Format
Input
A single line contains two integers and .
Interpretation
- Remove every digit
0from the decimal representation of . - Remove every digit
0from the decimal representation of . - Convert the remaining digit strings back to integers.
Output Format
Output
Print one integer — the sum of the two integers obtained after removing all zeros from the inputs.
Constraints
- The numbers fit in 64-bit signed integer arithmetic after zero removal and addition.
Example 1
Input
105 106
Output
31
Explanation
After removing zeros, the numbers become 15 and 16. Their sum is 31.
Example 2
Input
1000 1
Output
2
Explanation
After removing zeros, the numbers become 1 and 1. Their sum is 2.
Premium problem context
Unlock deeper context for this problem
Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.