https://school.programmers.co.kr/learn/courses/30/lessons/250125
def solution(board, h, w):
# 위, 아래, 왼, 오
x = [0, 0, -1, 1]
y = [-1, 1, 0, 0]
answer = 0
now = board[h][w] # color
height = len(board)
width = len(board[0])
for i in range(4):
nx = h + x[i]
ny = w + y[i]
# 정상 적인 범위
if nx >= 0 and ny >=0 and nx < width and ny < height :
if board[nx][ny] == now:
answer += 1
return answer