A cat is trapped in a 20×20 maze. Each cell is one of the following types:
'S': starting position of the cat'E': exit position'#': wall'_': empty cell'+': food'a' - 'z': teleport cellTwo 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.
Some pairs of cells are connected by teleportation. Each cell belongs to at most one teleport pair.
The cat cannot move onto a wall cell.
Initially, the entire maze is unknown to the cat.
The game proceeds in steps. In each step, the cat does the following:
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 the specified number of steps. This is guaranteed to be possible for all given test cases.
(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.
Note
Two cells with the same lowercase letter are paired teleport cells.
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.)
If the cat eats all food and reaches the exit within the specified number of steps, the program outputs SUCCESS.
Otherwise, the program outputs FAIL.
You will receive an AC only if the program outputs SUCCESS.