python
class Solution:
def compareVersion(self, version1: str, version2: str):
nums1 = version1.split('.')
nums2 = version2.split('.')
m, n = len(nums1), len(nums2)
if m < n:
for _ in range(n-m):
nums1.append('0')
elif m > n:
for _ in range(m-n):
nums2.append('0')
count = m if m > n else n
for i in range(count):
tmp1 = int(nums1[i])
tmp2 = int(nums2[i])
if tmp1 > tmp2:
return 1
elif tmp1 < tmp2:
return -1
return 0