题目描述
Problem Description
You are playing a certain bullet hell game.
Your goal is to operate your character properly to avoid getting hit by any bullets.
The map of this bullet hell game is represented by a grid of $ H $ rows and $ W $ columns.
You are given the initial state of the map at the start of the game.
The cell at the $ i $th row and $ j $th column contains a character $ c_{ij} $, which can be one of the following:
.: An empty cell.x: A cell with a bullet.s: A cell with your character. It exists exactly once at the bottom row of the map.
Both your character and the bullets move simultaneously and instantly from the start of the game after $t\ (1\ \leq\ t\ \leq\ H\ -\ 1)$ seconds. If your character and a bullet are in the same cell after movement, it counts as getting hit.
Each bullet moves one cell down with each move. Bullets that move out of the map disappear and do not appear in the game anymore.
Your character's movement is performed by outputting a sequence of commands.
The command sequence is a string of $H\ -\ 1$ characters, where the $ i $th character represents the movement of your character $ i $ seconds after the start of the game. Each character must be one of the following:
L: Move one cell to the left.R: Move one cell to the right.S: Stay in the same cell.
Note that you cannot give a command sequence that causes your character to move out of the screen during the game.
If there exists a command sequence that achieves the goal, output one of them. If not, output impossible.
Input Format
The input is given from the standard input in the following format:
$ H $ $ W $ $ c_{11}...c_{1W} $ $ c_{21}...c_{2W} $ $ : $ $ c_{H1}...c_{HW} $
Output Format
If there exists a command sequence that achieves the goal, output one of them (any one will do) in one line. If not, output impossible.
End your output with a newline.
Sample Input and Output
Sample Input #1
4 3
xx.
...
.xx
.s.
Sample Output #1
LRR
Sample Input #2
3 3
xxx
...
.s.
Sample Output #2
impossible
Sample Input #3
6 4
x.xx
.xxx
x.xx
xx.x
xx.x
.s..
Sample Output #3
RSLLR
Notes/Hints
Constraints
- $2\ \leq\ H,\ W\ \leq\ 10$
- $ c_{ij} $ is one of
.,x,s. - Your character always exists exactly once in one of the cells of the bottom row.
Sample Explanation 1
Following this command sequence to move your character results in the following:
xx.
...
...
...
L xx.
R ...
R ...
.xx
---> ...
---> xx.
---> ...
.s.
sxx
.s.
xxs
In this input, LRR is the only achievable command sequence.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分