#K90607. Valid Sudoku Checker
Valid Sudoku Checker
Valid Sudoku Checker
You are given a 9\times9 Sudoku grid. Your task is to determine whether the grid is valid. A valid Sudoku grid must satisfy the following conditions:
- Each row must contain the digits 1 to 9 at most once (ignoring zeros).
- Each column must contain the digits 1 to 9 at most once.
- Each 3\times3 sub-grid must contain the digits 1 to 9 at most once.
Note that the number 0 represents an empty cell and should be ignored when checking the constraints. Use standard input/output where the input consists of 9 lines with 9 space-separated integers each, and output a single line with either "True" or "False".
inputFormat
The input contains 9 lines. Each line has 9 integers separated by spaces, representing one row of the Sudoku grid.
outputFormat
Output a single line: "True" if the Sudoku grid is valid, or "False" otherwise.
## sample5 3 0 0 7 0 0 0 0
6 0 0 1 9 5 0 0 0
0 9 8 0 0 0 0 6 0
8 0 0 0 6 0 0 0 3
4 0 0 8 0 3 0 0 1
7 0 0 0 2 0 0 0 6
0 6 0 0 0 0 2 8 0
0 0 0 4 1 9 0 0 5
0 0 0 0 8 0 0 7 9
True