[form] input input file contains multiple test data, each test data contains three parts, part 1 a line, as the two integers, M, N (separated by Spaces), 2 & lt; M, N<=20, said the row and column of the map (line and column number starting from 1 meter). Part 2 is a line for a line of string, contains only F, B, L, R four characters, says tiger qiaohu robot receives instruction sequence, length of not more than 100 characters; Part 3 M lines, each row have N characters, these characters can be
The dot ". ", said can pass box;
Character "S", said the starting position of the tiger qiaohu robot (map of test data to ensure there is only one "S")
Characters "*", says obstacles, impassable,
Input file "0 0", the last behavior represents the end of the input,
Note: 1) if the received instructions for 'B' (back), is back in the opposite direction to the current heading a box, but towards the same;
2) tiger qiaohu robots can't out of the border, also cannot enter the obstacles of the lattice, so if you execute a command after the border or has entered the obstacles of the lattice, this order is invalid, skip this instruction, continue to implement the next instruction,
[form] output for each test data, the output of a line, for the two integers and one character at a time, separated by a space, finally said tiger qiaohu robot position (i.e., line and column number) and front, note: n, e, s, w, respectively was toward the north, east, south, west,
[sample input]
5 5
FFLRBFLLRBLLF
*... *
. *...
. S..
. *. *.
. *..
0 0
[sample output]
1 4 e
CodePudding user response:
Post and convenient to modify code,