PROGRAMMING:The Minesweeper game
Friends who have played Minesweeper know that the goal of the game is to find out all the mines in an n * m matrix. In this problem, you need to count the number of mines around each cell. Each cell has at most 8 adjacent cells. As shown in the figure below, in the 4 * 4 grid, use "*" to indicate mines and "^" to indicate no mines.
*^^^
^^^^
^*^^
^^^^
The results are as follows
*100
two thousand two hundred and ten
1*10
one thousand one hundred and ten
###Input format:
The input contains several matrices. For each matrix, the first row contains two numbers m and N, which respectively represent the number of rows and columns of the matrix (0 < n, m < 100). The next n rows contain M characters, which is the matrix, with "*" for mines and "^" for blanks. When n = M = 0, it means the end, and the line need not be processed.
###Output format:
For each matrix, first print the matrix serial number on a separate line: field # X: where x is the matrix number, starting from 1. In the next N lines, the "^" read in is replaced by the number of mines around the position, and the mines are still represented by "*". Output between two adjacent matrices, a blank line.
###Input example:
Here is a set of inputs. For example:
```in
4 4
*^^^
^^^^
^*^^
^^^^
8 8
*^^^*^^^
*^****^^
^*^^**^^
^^**^**^
^*^^**^^
*^^^*^^^
^^**^**^
^*^^**^^
0 0
```
###Output example:
The corresponding output is given here. For example:
```out
Field #1:
*100
two thousand two hundred and ten
1*10
one thousand one hundred and ten
Field #2:
*324*310
*4****20
2*56**41
23**6**1
2*34**31
*334*531
23**5**1
1*33**31
```
answer:If there is no answer, please comment
*^^^
^^^^
^*^^
^^^^
The results are as follows
*100
two thousand two hundred and ten
1*10
one thousand one hundred and ten
###Input format:
The input contains several matrices. For each matrix, the first row contains two numbers m and N, which respectively represent the number of rows and columns of the matrix (0 < n, m < 100). The next n rows contain M characters, which is the matrix, with "*" for mines and "^" for blanks. When n = M = 0, it means the end, and the line need not be processed.
###Output format:
For each matrix, first print the matrix serial number on a separate line: field # X: where x is the matrix number, starting from 1. In the next N lines, the "^" read in is replaced by the number of mines around the position, and the mines are still represented by "*". Output between two adjacent matrices, a blank line.
###Input example:
Here is a set of inputs. For example:
```in
4 4
*^^^
^^^^
^*^^
^^^^
8 8
*^^^*^^^
*^****^^
^*^^**^^
^^**^**^
^*^^**^^
*^^^*^^^
^^**^**^
^*^^**^^
0 0
```
###Output example:
The corresponding output is given here. For example:
```out
Field #1:
*100
two thousand two hundred and ten
1*10
one thousand one hundred and ten
Field #2:
*324*310
*4****20
2*56**41
23**6**1
2*34**31
*334*531
23**5**1
1*33**31
```
answer:If there is no answer, please comment