#K7691. Sudoku Solver
Sudoku Solver
Sudoku Solver
You are given a 9x9 Sudoku board with some cells filled with digits '1' through '9' and other cells containing a dot ('.') representing an empty cell. Your task is to complete the board so that each row, each column, and each \(3\times3\) sub-grid contains all of the digits from 1 to 9 exactly once.
The puzzle is guaranteed to have a unique solution.
Note: All formulas are written in \(\LaTeX\) format.
inputFormat
The input consists of 9 lines. Each line contains 9 tokens (either a digit or a dot '.') separated by spaces, representing a row of the Sudoku board.
outputFormat
Output the solved Sudoku board in 9 lines. Each line must contain 9 space-separated digits. The solution must satisfy that every row, column, and \(3\times3\) sub-grid has every digit from 1 to 9 exactly once.
## 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
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
</p>