#K73252. Largest Square Plot

    ID: 33934 Type: Default 1000ms 256MiB

Largest Square Plot

Largest Square Plot

In this problem, you are given the dimensions of a rectangular field, represented by two positive integers (l) and (w) (length and width respectively). Your task is to compute the side length of the largest square plot that can exactly cover the entire field without any remainder. Mathematically, the answer is given by the greatest common divisor (GCD) of (l) and (w): [ \text{side} = \gcd(l, w) ] This value represents the maximum possible square size that tiles the field exactly.

inputFormat

The input consists of two space-separated integers (l) and (w), which represent the length and width of the rectangular field respectively. Input is provided from standard input (stdin).

outputFormat

Output a single integer representing the side length of the largest square plot that can exactly cover the field. The output should be printed to standard output (stdout).## sample

18 24
6