Which One is Larger
Time limit1sMemory limit2048 MB
Given two decimals, print the larger one if comparing them as integer tuples (integer part, then fraction digits) agrees with normal decimal order, otherwise print -1.
- Level
Easy2 of 10
- Topics
- String, Implementation
- Solved
- No attempts yet
Problem
A question that often confuses a chat bot is:
or , which one is larger?
Some chat bots incorrectly state that is larger than . The exact reasoning behind that wrong answer is unknown, but one hypothesis is that the chat bot compared the decimal numbers as integer tuples, so that . Integer tuples and are compared by first comparing with . If they are equal, is compared with .
Given two decimal numbers, determine whether the result of integer tuple comparison matches the result of regular decimal comparison. If the two results agree, output the larger decimal number. Otherwise, output .
You may assume that the chat bot discards leading zeros when converting the digits after the decimal point to an integer, so becomes . If the two numbers are equal under integer tuple comparison, that counts as a different result from regular decimal comparison.
Input
Input has two lines. Each line contains one positive decimal number with 1 to 5 digits before the decimal point and 1 to 5 digits after it. There are no leading or trailing zeros, except that a single zero before or after the decimal point is allowed. The two decimal numbers are not equal.
Output
If integer tuple comparison and regular decimal comparison give the same result, output the larger decimal number. Otherwise, output .