问题 2148 --Chinese Checkers

2148: Chinese Checkers

时间限制: 1 Sec  内存限制: 32 MB
提交: 35  解决: 6
[提交][状态][讨论版][数据上传:][下载FPS1元][下载测试数据1元][20kb]

题目描述

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

提示

来源

[提交][状态]