By Daniel Correia, IFSULDEMINAS Brazil
Jhin loves to play with 2D games. One of his favorites is the game Tunnel, which by the way was created by himself. The game works as follows: A random array is given by 0s and 1s. The cells filled by 0s indicate the path that the object X must pass until there is no more 0s to be walked. Cells filled by 1s indicate obstacles in which object X can not pass.
As Jhin is still learning to program, he asked for his help to implement the game, and the goal is to declare that object X always be the start, directed to front, printing the necessary instructions the instructions necessary for X to reach the last cell 0.
Assume that the instructions are: F (Front), L (Left) and R (Right).
The input is composed of several test cases. Each case starts with a line containing an integer M (2 <= M <= 100) and an integer N (2 <= N <= 100) representing M rows and N matrix columns of 0s and 1s. Next, we give the matrix M x N that represents the path and obstacles.
The output should be composed of a line for each test case, containing all instructions generated by the game, separated by a space. After the last, you must put the letter E (end)
|Input Sample||Output Sample|
F L F R F E