测评会员优惠活动进行中 · 开通 VIP,有效期内测评不限次 VIP 优惠中 · 测评不限次 立即查看

A10491. King Moves

编程题 普及/提高-

题目描述

The only king stands on the standard chess board. You are given his position in format "cd", where $c$ is the column from 'a' to 'h' and $d$ is the row from '1' to '8'. Find the number of moves permitted for the king.

Check the king's moves here <a>https://en.wikipedia.org/wiki/King\_(chess)</a>.

![](/uploads/acgo/image/8f595fce64e34150_c35c79ec60f8.jpeg)King moves from the position e4

输入格式

The only line contains the king's position in the format "cd", where 'c' is the column from 'a' to 'h' and 'd' is the row from '1' to '8'.

输出格式

Print the only integer $x$ — the number of moves permitted for the king.

输入输出样例

输入 #1
e4
输出 #1
8
上一题 去做题 下一题