Mutint
Time limit1sMemory limit1024 MB
Given several positive integers ending with a zero, change each number's leftmost largest digit: odd digits become 0, and even digits gain 4 (mod 10).
- Level
Easy1 of 10
- Topics
- Implementation, String
- Solved
- No attempts yet
Problem
A "Mutint" is an integer M that is changed according to certain criteria, such as in this problem. Given a positive integer, change M according to the following rules.
- Find the leftmost largest digit D of M.
- If D is odd, change it to a zero.
- If D is even, add 4 to that digit. If the sum exceeds 9, change D to the ones digit of the sum.
Input
Several integers, each on one line. The end of input is signaled with a zero on the last line. All integers, except the last integer, are positive.
Output
Print M, according to the rules above. M cannot have leading zeros.