#C2745. Sudoku Validator
Sudoku Validator
Sudoku Validator
You are given a 9x9 Sudoku board. Your task is to determine whether the board is a valid Sudoku solution. In a valid solution, each row, each column, and each of the nine 3x3 sub-grids (blocks) must contain all the digits from 1 to 9 exactly once.
The rules can be mathematically expressed as follows:
$$\forall i \in \{0, \dots, 8\}, \; \{board[i][j] : j \in \{0, \dots, 8\}\} = \{1,2,\dots,9\} $$$$\forall j \in \{0, \dots, 8\}, \; \{board[i][j] : i \in \{0, \dots, 8\}\} = \{1,2,\dots,9\} $$$$\forall (r, c) \in \{0,3,6\}^2, \; \{ board[i][j] : i \in \{r, r+1, r+2\}, j \in \{c, c+1, c+2\} \} = \{1,2,\dots,9\} $$The board is provided as input from standard input (stdin) and your output should be printed to standard output (stdout).
inputFormat
The input consists of 9 lines. Each line contains 9 integers separated by spaces representing a row of the Sudoku board. Each integer must be in the range [1,9].
outputFormat
Output a single line: 'True' if the board is a valid Sudoku solution, otherwise 'False'.## sample
5 3 4 6 7 8 9 1 2
6 7 2 1 9 5 3 4 8
1 9 8 3 4 2 5 6 7
8 5 9 7 6 1 4 2 3
4 2 6 8 5 3 7 9 1
7 1 3 9 2 4 8 5 6
9 6 1 5 3 7 2 8 4
2 8 7 4 1 9 6 3 5
3 4 5 2 8 6 1 7 9
True