Numerology
Hard
Execution time limit is 1 second
Runtime memory usage limit is 64 megabytes
Neville poured the matchsticks onto the table, forming a number with digits that seemed ominous. To change this forecast, Neville needs to transform the number by moving just one matchstick. The goal is to create the largest possible number to reduce the chance of an undesirable event.
The digits formed by the matchsticks resemble those on Muggle calculators:
Write a program that takes the number formed by the matchsticks and outputs the new number after moving one matchstick.
Input
The input consists of a single integer N (1 ≤ N < 10^9).
Output
Output the new number K (K > 0, K ≠ N; if there are multiple possibilities, choose the largest one) or the message FAIL if it is impossible to change the number by moving one matchstick.
Examples
Input #1
Answer #1
Submissions 301
Acceptance rate 7%