#K77262. Chess Knight Moves
Chess Knight Moves
Chess Knight Moves
Given a chessboard and a knight's position, determine the number of valid moves the knight can make from the given position. A knight moves in an L-shape: two squares in one direction and one square perpendicular to that. Mathematically, if the knight is at position \((x, y)\), its potential moves are given by:
[ {(x \pm 2, y \pm 1),\ (x \pm 1, y \pm 2)}\n]
The chessboard columns are labeled from 'a' to 'h' and the rows from 1 to 8. You need to compute the total count of moves that stay within these boundaries.
inputFormat
The input consists of a single line containing a string that represents the knight's position on the chessboard (for example, "d4").
This input is read from stdin.
outputFormat
Output a single integer which is the number of valid moves that the knight can make from the given position.
This output should be printed to stdout.
## sampled4
8
</p>