Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Version Checker

By faiyaz26 · Limits 1s, 512 MB

Java Development Kit (JDK) installer for Mac OS X has a bug:

Can you spot it? Notice how Java is checking the operating system version number. Logic dictates that 10.10.5 is obviously a newer version than 10.7.3. So something is incorrect in the way the installer trying to compare the version numbers. Can you come up with a correct algorithm? Do you have what it takes to get this right?

Input

There will be only one line with two version strings. Each version number can have no dots or at most two (.) dots. And there will be at most two consecutive digits (0 - 9) in the given version number.

Output

You need to print out the latest version number comparing the given two versions. If the both version numbers are the same print the string that is longest in terms of string length.

Samples

InputOutput
10.11.12 10.99.99
10.99.99
InputOutput
11.1 1.11
11.1

In the second sample case 1.11 can be considered as 01.11.00 and 11.1 can be considered as 11.01.00.


Discussion
Statistics

54% Solution Ratio

sakibalamin Earliest, Jun '17

Tarik.amtoly Fastest, 0.0s

TSRaihan Lightest, 0 B

touhidur Shortest, 221B

Submit

Login to submit