In Python
Write a function to read a Sudoku board from an inputstring.
The input string must be exactly 81 characters long (plusthe
terminating null that marks the end of the string) andcontains
digits and dots (the `.` character represents an unmarkedposition).
The input contains all 9 rows packed together. For example, aSudoku
board that looks like this:
```
..7 ... ...
6.4 ... ..3
... .54 ..2
... .4. ...
9.. ... ..5
385 ..2 ...
... ..3 78.
49. 71. ...
1.. ..8 9..
```
would be input as the string
```
\"..7......6.4.....3....54..2....4....9.......5385..2........378.49.71....1....89..\"
```
The function must read the board into an array of 81 bytes, withthe
value 0 (*not* the digit `'0'`) for unfilled positions(represented
by dots in the input) and the values 1 through 9 (*not*the digits
`'1'` through `'9'`) for filled positions.
As it reads, the function should validate the input. If it istoo
short, it should return 1. If it encounters an invalidcharacter
(not a dot or a digit) then it should return 2. If the string istoo
long it should return 3.
The following pseudocode should form the basis of yourfunction: