SDE Path

Compare Two Version Numbers

Medium

Compare Two Version Numbers

Given two version number strings, determine which is greater by comparing their revision numbers.

Input format

Two lines, each a version string like "1.0.3" (dot-separated non-negative integers).

Output format

Print 1 if the first version is greater, -1 if the second is greater, or 0 if they are equal (missing revisions count as 0).

Constraints

  • Values fit in a 64-bit signed integer
  • Trailing whitespace and a trailing newline are ignored by the judge

Read from stdin, write to stdout. Sample cases below show the exact format.

Sample cases

Example 1
Input
1.0.1 1
Expected output
1
Example 2
Input
1.01 1.001
Expected output
0