Problem 2148 --Chinese Checkers

2148: Chinese Checkers

Time Limit: 1 Sec  Memory Limit: 32 MB
Submit: 35  Solved: 6
[Submit][Status][Web Board][Creator:][下载FPS1元][添加到购物车][下载测试数据1元][20kb]

Description

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).

Input

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.

Output

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. 

Sample Input

b*.*..*.a
b***.a*..

Sample Output

3
0

HINT

Source

[Submit][Status]