calculate the possible moves of the bishop

hi, all
can any one help me in this proplem in c++

Nada was playing chess with her best friends.

While playing with her friends, she was so good at playing chess that her friends wondered if she can tell how many moves a bishop can move or not.

They gave her the coordinates of the bishop in the chess board where the columns coordinates are between 'a' and 'h' inclusive and the rows are between '1' and '8' inclusive, if you need more clarification on how the bishop moves you can look at the notes.

Now, they want you to make a program to check if the number of moves that Nada told them are right or not.

Input:
The input will consist of two characters, the first one will be a character that describe the column between 'a' and 'h' inclusive, while the second input will be another character that describe the row between '1' and '8'.Which mean that if the input is "b8" it means the second column and the row number eight.

Output:
The output will be one line which contains the right number of moves of the bishop.

Examples:

input
a1
output
7

input
d5
output
13
Topic archived. No new replies allowed.