Skip to main content
Back to problems
Codeforces
Easy
Math
Strings
Life Without Zeros

Output two given positive integers after removing every digit 0, then also remove any leading zeros from the resulting numbers.

Acceptance 0%
Also Available On
Other platform versions and source mappings for the same problem.
Problem Statement

Problem

You are given two positive integers aa and bb. 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:

  1. Reads two integers.
  2. Deletes all 0 digits from each integer independently.
  3. Treats the remaining digits as integers.
  4. Prints the sum of those two values.

Input Format

Input

A single line contains two integers aa and bb.

Interpretation

  • Remove every digit 0 from the decimal representation of aa.
  • Remove every digit 0 from the decimal representation of bb.
  • 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

  • 1a,b1091 \le a, b \le 10^9
  • The numbers fit in 64-bit signed integer arithmetic after zero removal and addition.
Examples
Sample cases returned by the problem API.

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.

Guided hints
Editorial and discussion links
Concept map and variants
Sign in to unlock
Track your progress
Sign in to bookmark this problem, save notes, and manage its revision plan.