DWITE Contest

Test Case for Question #4 in DWITE 2007-2008 High School Round 5

Contest: DWITE 2007-2008 High School Round 5
Question: #4
Input File: DATA4.txt
Output File: OUT4.txt


Input

S---E     
xxxxxxxxxx
...       
S .       
. .       
E..       
xxxxxxxxxx
..........
S        |
 `--E----`
xxxxxxxxxx
 .--o---  
|   |   ` 
S---o   | 
|   |   | 
 `--E---` 
xxxxxxxxxx
.---< >--E
|       / 
S--o--. | 
  `o   Y  
    `-`   
xxxxxxxxxx




Output

4
2
4
5
10