A cat is trapped in a 20×20 maze. Each cell is one of the following types:
'S': starting position'E': exit position'#': wall'_': empty cell'+': foodThe cat starts at 'S'. Initially, the whole maze is unknown to the cat.
The game proceeds in steps. In each step, the cat does the following:
Two cells are adjacent if they share a side, that is, if one is directly above, below, to the left of, or to the right of the other.
When the cat moves onto a cell with food, the food is eaten and the cell becomes empty immediately.
Your goal is to make the cat eat all food and then reach the exit cell within 10000 steps.
Note
(The input is already handled by the provided C++ code.)
The input contains exactly 20 lines.
Each line contains exactly 20 characters, representing the maze.
The maze contains exactly one S and exactly one E.
The outer boundary of the maze is guaranteed to be #. (See the sample input for an example.)
Subtasks:
(The output is already handled by the provided C++ code.)
Output one line.
If the cat eats all food and reaches the exit within 10000 steps, output: SUCCESS.
Otherwise, output: FAIL.
You will receive an AC only if the program outputs SUCCESS.