Dyslexic taxi driver P48760


Statement
 

pdf   zip

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 between 10 and 10910^9.

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.

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++