Reversed Addition
InterviewTime limit2sMemory limit128 MB
Reverse the digits of two numbers up to 1000, add the reversed values, then reverse the sum and print the result.
- Level
Easy2 of 10
- Topics
- Math, Implementation
- Solved
- No attempts yet
Problem
For a positive integer X, define Rev(X) as the integer obtained by reading the decimal digits of X in reverse order. Any leading zeroes created by the reversal are discarded. For instance, Rev(123) is 321, and Rev(100) is 1.
Given two positive integers X and Y, compute Rev(Rev(X) + Rev(Y)).
Input
The first line contains two integers X and Y. Both X and Y are natural numbers no greater than 1,000.
Output
Print the answer on the first line.