题库练习 King Moves
← 上一题 下一题 →

A10491 | King Moves

时间限制1s
内存限制256MB
通过 / 提交0/0

题目描述

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
C++ 编辑器
输入
输出