Dyslexic taxi driver

You arranged a taxi pick up, so you provided your address, which
includes your street number n. However, the taxi driver is a bit
dyslexic, and he will swap exactly two digits of n. What are the minimum
and the maximum possible distances (measured as the number differences)
between your real address and the place where the taxi driver will show?

Input

Input consists of several cases, each one with an n between 10 and 10⁹.

Output

For every n, print the minimum and the maximum possible distances. Take
into account that the taxi driver can place a zero as starting digit.

Problem information

Author: Salvador Roura

Generation: 2026-01-25T11:27:42.755Z

© Jutge.org, 2006–2026.
https://jutge.org
