Problem1067--PIPI的棋盘

1067: PIPI的棋盘

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 128 MB

Description

PIPI现在有一个8*8的棋盘,他想让骑士棋子在8*8的棋盘上移动,骑士和中国象棋中的"马"移动规则相同,都是往8个方向走"日"字型。1-8代表行号,a-h代表列号,给出骑士的初始位置和目的位置,求骑士从初始位置到目的位置最少的移动步数。

Input

输入包含多组测试用例。
对于每一组测试用例,输入两个字符串,分别代表骑士的初始位置和目的位置。

Output

对于每一组测试用例,输出如样例所示。

Sample Input Copy

e2 e4
a1 b2
b2 c3
a1 h8
a1 h7
h8 a1
b1 c3
f6 f6

Sample Output Copy

To get from e2 to e4 takes 2 knight moves.
To get from a1 to b2 takes 4 knight moves.
To get from b2 to c3 takes 2 knight moves.
To get from a1 to h8 takes 6 knight moves.
To get from a1 to h7 takes 5 knight moves.
To get from h8 to a1 takes 6 knight moves.
To get from b1 to c3 takes 1 knight moves.
To get from f6 to f6 takes 0 knight moves.

Source/Category