#C8423. Find the Greatest Common Divisor

    ID: 52404 Type: Default 1000ms 256MiB

Find the Greatest Common Divisor

Find the Greatest Common Divisor

Given two non-negative integers a and b, find their greatest common divisor (GCD). The GCD of two numbers is the largest positive integer that divides both of them without a remainder.

You can use the formula: $$\gcd(a, b)$$, where the result is defined as:

  • If both a and b are zero, then GCD is defined as 0.
  • If one of them is zero, the GCD is the other number.
  • Otherwise, it is the largest integer that divides both a and b.

Input is read from standard input and the result should be printed to standard output.

Example: Input: 48 18 Output: 6

inputFormat

The input consists of a single line containing two non-negative integers a and b separated by a space.

outputFormat

Output a single integer which is the greatest common divisor of a and b.

## sample
48 18
6

</p>