You are given two versions numbers A and B as a string. Your task is to compare them and find out which one of them is a newer version.
There are no leading zeros in any of the strings except in the case of zero itself. Note that, the leading zeroes are not allowed even after a '.' ie: 121.005 is an invalid version, while 121.5 is an valid version.
A = “1.23.45”, B = “1.23.456”
The first two parts of both the strings are the same i.e 1 and 23 and the third part of B is greater than the third part of A i.e. 45 < 456, thus string B is the latest version.
Sample Input 1:
Sample Output 1:
Explanation for Sample Input 1:
For the first test case, the first two parts of both the strings are the same but the third part of the 1st version is bigger than the 2nd version. Hence our answer is 1
For the second test case, both the versions are identical here, so the answer will be 0.
Sample Input 2:
Sample output 2: