A Sudoku rd is a l6xl6 grid of cels grouped in sixteen 4x4 squares, where some cells are filled with leters from A to P (the first 16 capital leters of theEnglish alphabet,as shown in figure la. The game is to fil all the empy grid cells with letters fom A to P such that each letter ftom the grid occurs once onlyin the ine, the column, and the 4x4 square it occupies, The inital content ofthe erid salishes the constraints mentioned above and guarantes a umique soluion.
Write a Sudoku playing program that reads data sets from a text file.
Each data set encodes a grid and contains 16 strings on 16 consecutive lines as shown in figure 2. The i-th string stands for the i-th line ofthe grid, is 16characters long,and starts from the first position ofthe line. tring characters are from the set (A,B,.,?,;, where- (minus) designates empty grid cels. Thedata sets are separated by single empty lines and terminate with an end of file.
The program prints the solution of the input encoded grids in the same format and order as used for input.
--A----C-----〇-I -J--A-B-P-CGF-H ---D--F-I-E----P- -G-EL-H----M-J-- ----E----C--G---- -I--K-GA-B---E-J D-GP--J-F----A-- -E---C-B--DP--O- E--F-M--D--L-K-A -C--------〇-I-L- --H-P-C--F-A--B--- ---G-〇D---J----H K---J----H-A-P-L --B--P--E--K--A- -H--B--K--FI-C-- --F---C--D--H-N-
FPAHMJECNLBDKOGI OJMIANBDPKCGFLHE LNDKGFOIJEAHMBPC BGCELKHPОFIMAJDN MFHBELPOACKJGNID CILNKDGAHBMОPEFJ DOGPIHJMFNLECAKB JEKAFCNBGIDPLHOM EBOFPMIJDGHLNKCA NCJDHBAEKMOFIGLP HMPLCGKFIAENBDJO AKIGNODLBPJCEFMH KDEMJIFNCHGAOPBI GLBCDPMHEONKJIAF PHNOBALKMJFIDCEG IAFJOECGLDPBHMNK