Dyslexic taxi driver (2) P21156


Statement
 

pdf   zip

html

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 105 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.

Public test cases
  • Input

    37
    99
    902
    2342
    

    Output

    36 36
    0 0
    18 810
    0 1980
    
  • Information
    Author
    Salvador Roura
    Language
    English
    Official solutions
    C++
    User solutions
    C++