Appoint description:
Description
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 https://en.wikipedia.org/wiki/King_(chess).
Input
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'.
Output
Print the only integer x — the number of moves permitted for the king.
Sample Input
Input
e4
Output
8
可以走多少步(周围有多少格)

本文介绍了一个简单的程序,用于确定国际象棋中王的合法移动数量。通过输入王的位置,程序能够计算出根据标准国际象棋规则王可以从当前位置进行的所有合法移动数。
701

被折叠的 条评论
为什么被折叠?



