PROGRAMMING:Additional questions - maze
Snow White is trapped in a maze the size of M \ * n. the obstacles in the maze are impassable. In the maze, s stands for Snow White's position, e stands for the exit, #stands for the obstacle, and \ * stands for the passable road. Snow white can only walk up, down, left and right, and each step can only walk one unit of length. Given the shape of M, N and labyrinth, how many times does it need to change the direction of X to get to the exit? If x can't reach the exit, it will output - 1, otherwise it will output the minimum number of times to change the direction. Snow white will try her best to change the direction less, as long as the two adjacent walking directions are different, it will change the direction once( 1<=M,N<=100)
###Input format:
Enter two positive integers m and N in the first line,
Next, enter the labyrinth of M \ * n. The Labyrinth elements only contain s, e, \ *, #.
###Output format:
If Snow White can reach exit e from s, the output will change direction at least, otherwise - 1 will be output, and each output will occupy one line.
###Input example:
Here is a set of inputs. For example:
```in
5 5
S****
####*
*####
****E
```
###Output example:
The corresponding output is given here. For example:
```out
four
```
Because the obstacles (#) can't pass, snow white can only get to e through * and needs to turn at least 4 times < br > < br > < br > < br > < br > at the same time
answer:If there is no answer, please comment
###Input format:
Enter two positive integers m and N in the first line,
Next, enter the labyrinth of M \ * n. The Labyrinth elements only contain s, e, \ *, #.
###Output format:
If Snow White can reach exit e from s, the output will change direction at least, otherwise - 1 will be output, and each output will occupy one line.
###Input example:
Here is a set of inputs. For example:
```in
5 5
S****
####*
*####
****E
```
###Output example:
The corresponding output is given here. For example:
```out
four
```
Because the obstacles (#) can't pass, snow white can only get to e through * and needs to turn at least 4 times < br > < br > < br > < br > < br > at the same time
answer:If there is no answer, please comment