#왕실의 나이트 
a = input()
r = int(a[1])
z=0
col = int(ord(a[0])) - int(ord('a')) + 1
x=[1,2,-1,-2]
y=[2,1,-2,-1]
for i in range(4):
    for j in range(2):
        if(col+x[i]<9 and col+x[i]>0 and r+y[(i%2)+(j*2)]>0 and r+y[(i%2)+(j*2)]<9):
            z=z-1
        z=z+1
print(8-z)

+ Recent posts