Dyslexic taxi driver (2)

You arranged a taxi pick up, so you provided your address, which includes your street number nn. However, the taxi driver is a bit dyslexic, and he will swap exactly two digits of nn. 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 nn, with between 2 and 10510^5 digits.

Output

For every nn, 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