Problem J
Tight-Fit Sudoku
At some point or another, most computer science students have written a standard Sudoku solving program. In a standard Sudoku puzzle, a $9 \times 9$ grid that is partially filled in with digits is given. The task is to complete the grid so that each digit occurs exactly once in every row, column, and in each of $9$ $3 \times 3$ non-overlapping subregions marked in the grid. This problem adds a slight twist to standard Sudoku to make it a bit more challenging.
Digits from $1$ to $9$ are entered in a $6 \times 6$ grid so that no number is repeated in any row, column or $3 \times 2$ outlined region as shown below. Some squares in the grid are split by a slash and need $2$ digits entered in them. The smaller number always goes above the slash.
Incomplete Grid |
Solution Grid |
For this problem, you will write a program that takes as input an incomplete puzzle grid and outputs the puzzle solution grid.
Input
The input consists of a single data set. This data set consists of $6$ lines of input representing an incomplete Tight-Fit Sudoku grid. Each line has $6$ data elements, separated by spaces. A data element can be a digit (1-9), a dash (‘-’) for a blank square or two of these separated by a slash (‘/’).
Output
Output $6$ lines showing the solution grid for the given input data set. Each line will have $6$ data elements, separated by spaces. A data element can be a digit (1-9) or $2$ digits separated by a slash (‘/’). The input will be chosen such that the solution grid is unique.
Sample Input 1 | Sample Output 1 |
---|---|
-/- -/5 4 3 2 -/- - 6 -/- -/- - -/- - 7/- - -/- -/- 2 8 -/- -/- - -/3 - -/- - -/- -/- 4 - -/- 8 7 6 5/- -/- |
7/9 1/5 4 3 2 6/8 3 6 2/8 1/9 7 4/5 1 7/9 3 4/5 6/8 2 8 2/4 5/6 7 1/3 9 5/6 3 1/9 2/8 4 7 2/4 8 7 6 5/9 1/3 |