#K42557. Valid Sudoku Checker

    ID: 27113 Type: Default 1000ms 256MiB

Valid Sudoku Checker

Valid Sudoku Checker

Your task is to verify whether a given 9x9 Sudoku board configuration is valid. A Sudoku board is valid if each row, each column, and each of the nine \(3\times3\) subgrids (also called blocks) contains no duplicate numbers among the digits \(1\) to \(9\). The empty cells are represented by the character . and should be ignored when checking for duplicates.

Note that the board only needs to be valid according to the rules above; it does not necessarily need to be solvable.

Example: For the board below, the output should be True since it meets the rules:

5 3 . . 7 . . . .
6 . . 1 9 5 . . .
. 9 8 . . . . 6 .
8 . . . 6 . . . 3
4 . . 8 . 3 . . 1
7 . . . 2 . . . 6
. 6 . . . . 2 8 .
. . . 4 1 9 . . 5
. . . . 8 . . 7 9

inputFormat

The input is read from standard input and consists of 9 lines. Each line represents a row of the Sudoku board and contains 9 characters separated by a single space. Each character is either a digit from 1 to 9 or a dot . representing an empty cell.

For example:

5 3 . . 7 . . . .
6 . . 1 9 5 . . .
. 9 8 . . . . 6 .
8 . . . 6 . . . 3
4 . . 8 . 3 . . 1
7 . . . 2 . . . 6
. 6 . . . . 2 8 .
. . . 4 1 9 . . 5
. . . . 8 . . 7 9

outputFormat

Print to standard output a single line: True if the given Sudoku board is valid; otherwise, print False.

## sample
5 3 . . 7 . . . .
6 . . 1 9 5 . . .
. 9 8 . . . . 6 .
8 . . . 6 . . . 3
4 . . 8 . 3 . . 1
7 . . . 2 . . . 6
. 6 . . . . 2 8 .
. . . 4 1 9 . . 5
. . . . 8 . . 7 9
True