{"raw_statement":[{"iden":"problem statement","content":"You are given an $H × W$ grid.  \nThe squares in the grid are described by $H$ strings, $S_1,...,S_H$.  \nThe $j$\\-th character in the string $S_i$ corresponds to the square at the $i$\\-th row from the top and $j$\\-th column from the left $(1 \\leq i \\leq H,1 \\leq j \\leq W)$.  \n`.` stands for an empty square, and `#` stands for a square containing a bomb.\nDolphin is interested in how many bomb squares are horizontally, vertically or diagonally adjacent to each empty square.  \n(Below, we will simply say \"adjacent\" for this meaning. For each square, there are at most eight adjacent squares.)  \nHe decides to replace each `.` in our $H$ strings with a digit that represents the number of bomb squares adjacent to the corresponding empty square.\nPrint the strings after the process."},{"iden":"constraints","content":"*   $1 \\leq H,W \\leq 50$\n*   $S_i$ is a string of length $W$ consisting of `#` and `.`."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$H$ $W$\n$S_1$\n$:$\n$S_H$"},{"iden":"sample input 1","content":"3 5\n.....\n.#.#.\n....."},{"iden":"sample output 1","content":"11211\n1#2#1\n11211\n\nFor example, let us observe the empty square at the first row from the top and first column from the left.  \nThere is one bomb square adjacent to this empty square: the square at the second row and second column.  \nThus, the `.` corresponding to this empty square is replaced with `1`."},{"iden":"sample input 2","content":"3 5\n#####\n#####\n#####"},{"iden":"sample output 2","content":"#####\n#####\n#####\n\nIt is possible that there is no empty square."},{"iden":"sample input 3","content":"6 6\n#####.\n#.#.##\n####.#\n.#..#.\n#.##..\n#.#..."},{"iden":"sample output 3","content":"#####3\n#8#7##\n####5#\n4#65#2\n#5##21\n#4#310"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}