Difference Between 5 and 6
InterviewTime limit1sMemory limit128 MB
Given two integers, compute the minimum and maximum possible sums after freely swapping digits 5 and 6 in each number.
- Level
Easy2 of 10
- Topics
- String, Greedy, Implementation
- Solved
- No attempts yet
Problem
A person may confuse the digits 5 and 6. When reading a 5, they may see it as 5 or mistakenly as 6; when reading a 6, they may see it as 6 or mistakenly as 5.
Given two integers A and B, there are several possible values for A+B under this reading. Find the minimum and maximum possible sums.
Input
The first line contains two integers A and B. (1 <= A, B <= 1,000,000)
Output
Print the minimum and maximum possible sums, separated by a space.