#C11498. Checkerboard Pattern Generator

    ID: 40820 Type: Default 1000ms 256MiB

Checkerboard Pattern Generator

Checkerboard Pattern Generator

Given two integers m and n representing the number of rows and columns respectively, your task is to generate an m × n checkerboard pattern using the characters 'X' and 'O'. The pattern should start with an 'X' at the top-left cell. For each cell at row i and column j (0-indexed), output 'X' if \((i+j) \mod 2 = 0\) and 'O' otherwise.

Print the resulting pattern to standard output, where each row is printed on a new line with a single space separating the characters.

inputFormat

The input consists of two space-separated integers on a single line:

  • m – the number of rows.
  • n – the number of columns.

You should read the input from standard input (stdin).

outputFormat

Output the checkerboard pattern with m lines. Each line should contain n characters ('X' or 'O') separated by a single space, printed to standard output (stdout).

## sample
3 3
X O X

O X O X O X

</p>