Broken Odometer
InterviewTime limit0.5sMemory limit128 MB
Convert an odometer reading that skips the digit 4 back into the real distance traveled, using a base-9-like digit mapping.
- Level
Easy3 of 10
- Topics
- Math, Implementation, String
- Solved
- No attempts yet
Problem
Suhyun's car has an odometer. This odometer cannot display the digit 4, so its displayed values go directly from 3 to 5. For example, if the display shows 15339m and the car actually travels 1 more meter, the display becomes 15350m.
Given the distance shown on the odometer, compute the actual distance that Suhyun's car has traveled.
Input
The first line contains the distance shown on the odometer. The value is an integer between 1 and 999,999,999, inclusive.
Output
Print the actual distance traveled.