跳到主要内容
图灵 OJTURING / ONLINE JUDGE

#F1111. King Moves

    ID: 1117 传统题 2000ms 256MiB 尝试: 0 已通过: 0 难度: 1 上传者: 标签>模拟编程与模拟入门难度共享题库Codeforces英文题面题目来源题面语言

King Moves

题目描述

A. King Moves
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

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).

King moves from the position e4
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.

Example
Input
e4
Output
8


题目来源:fps-www.educg.net-codeforce-1-2833.xml.zip;FPS 共享题包,题包内第 578 题。保留原作者与原赛事署名。