Dyslexic taxi driver (2)

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, with between 2 and
10⁵ digits.

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-25T10:10:54.820Z

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