#C9329. Valid Sudoku Checker
Valid Sudoku Checker
Valid Sudoku Checker
You are given a partially filled 9x9 Sudoku board. Your task is to determine whether the board is valid according to the following rules:
- Each row must contain the digits \(1\) through \(9\) at most once (ignoring the empty cells denoted by '.').
- Each column must contain the digits \(1\) through \(9\) at most once.
- Each of the nine 3x3 sub-grids must contain the digits \(1\) through \(9\) at most once.
Note: The board can include the character '.' to represent an empty cell. It is not required to solve the puzzle; only validity is checked.
inputFormat
The input consists of 9 lines, each containing 9 tokens separated by a single space. Each token is either a digit from 1 to 9 or the character '.' representing an empty cell.
outputFormat
Output a single line containing either "Valid" or "Invalid" depending on whether the sudoku board is valid as per the rules.
## sample5 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
Valid