구현 (115)
temp = input()
x = temp[0]
y = int(temp[1])
cnt = 0
if ('c' <= x <= 'f'):
if (2 <= y <= 7):
cnt += 4
else:
cnt += 2
elif (x < 'c'):
if (2 <= y <= 7):
cnt += 2
else:
cnt += 1
elif (x > 'f'):
if (2 <= y <= 7):
cnt += 2
else:
cnt += 1
if (3 <= y <= 6):
if ('b' <= x <= 'g'):
cnt += 4
else:
cnt += 2
elif (y < 3):
if ('b' <= x <= 'g'):
cnt += 2
else:
cnt += 1
elif (y > 6):
if ('b' <= x <= 'g'):
cnt += 2
else:
cnt += 1
print(cnt)
temp = input()
# 거꾸로 입력했을 때 바꿔줌
if (temp[0].isdigit() and temp[1].isalpha()):
temp = temp[::-1]
x = temp[0]
alpha = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']
x = alpha.index(x) + 1
y = int(temp[1])
arr = [[-2, 1], [2, 1], [-2, -1], [2, -1], [-1, 2], [1, 2], [-1, -2], [1, -2]]
cnt = 0
for row, col in arr:
width, height = x, y
width = x + row
height = y + col
if (1 <= width <= 8 and 1 <= height <= 8):
cnt += 1
print(cnt)