**Description:**

Given a position of a knight on the standard chessboard, find the number of different moves the knight can perform.

The knight can move to a square that is two squares horizontally and one square vertically, or two squares vertically and one square horizontally away from it. The complete move therefore looks like the letter L. Check out the image below to see all valid moves for a knight piece that is placed on one of the central squares.

**Example**

- For
`cell = "a1"`

, the output should be

`chessKnightMoves(cell) = 2`

. - For
`cell = "c2"`

, the output should be

`chessKnightMoves(cell) = 6`

.

**Input/Output**

**[time limit] 3000ms (java)**

**[input] string cell**String consisting of 2 letters – coordinates of the knight on an

`8 × 8`

chessboard in chess notation.**[output] integer**

**Tests:**

**Solution(Java):**

int chessKnightMoves(String cell) { int x = cell.charAt(0) % 97, y = +cell.charAt(1) - '0' - 1; int c = 0; for (int dx = -2; dx <= 2; dx++) for (int dy = -2; dy <= 2; dy++) { if (Math.abs(dx * dy) == 2) if (isValid(x + dx, y + dy)) c++; } return c; } private static boolean isValid(int x, int y) { return x >= 0 && x <= 7 && y >= 0 && y <= 7; }