import pprint
import sys
sys.stdin = open("input.txt","r")
col, row = map(int,input().split())
matrix = []
count = 0
for i in range(row):
matrix.append(list(input()))
for i in range(row):
for j in range(col):
if matrix[i][j] == '*':
print('*',end='')
continue
for index_row in range(-1,2):
for index_col in range(-1,2):
if 0 <= i - index_row < row and 0 <= j - index_col < col:
if matrix[i-index_row][j-index_col] == '*':
count += 1
print(count,end='')
count = 0
print()
Q)
표준 입력으로 2차원 리스트의 가로(col)와 세로(row)가 입력되고 그 다음 줄부터 리스트의 요소로 들어갈 문자가 입력됩니다. 이때 2차원 리스트 안에서 *는 지뢰이고 .은 지뢰가 아닙니다. 지뢰가 아닌 요소에는 인접한 지뢰의 개수를 출력하는 프로그램을 만드세요(input에서 안내 문자열은 출력하지 않아야 합니다).
인데
for문이 좀 많은 것 같은데 어떤걸 고쳐아할까
보기싫어.....