#1260. Chinese Checkers
Chinese Checkers
说明
In chinese checkers a piece can jump must meet two conditions:
1.There is no piece on the Jump-off point and the droppoint.Meanwhile,There is one and only one piece between the two points.
2.The only piece must be right in the middle of the two points.
For example,from a jump to b('a' is jump-off point,'b' is droppoint,'*' means piece in the position,'.'means no piece in the position).
the cases can jump: a*b a..*..b a.....*.....b
the cases cannot jump: a**b a.*..b a...*.*...b a.*...b
Now Given a one-dimensional checkerboard,how many times need to jump from a to b(No other movement but jump).
输入格式
The input consists of multiple test cases.Each case contain one line with a character string(length is less than 100),means a one-dimensional checkerboard.'a' is jump-off point,'b' is droppoint,'*' means piece in the position,'.'means no piece in the position.There is only these four character in the string,and there is just one 'a' and one 'b'.There is no piece on the 'a' and 'b' position.
输出格式
For each test case,you should output the least times need to jump from a to b in one line and with one line of output for each line in input.If there is no jump path from a to b,you should output 0.
样例
b*.*..*.a
b***.a*..
3
0