#C11690. Machine Command Translator
Machine Command Translator
Machine Command Translator
You are given a series of commands, each consisting of two words: an action and a direction.
The available actions and their corresponding abbreviations are given by:
\( \text{walk}\to W,\quad \text{run}\to R,\quad \text{jump}\to J,\quad \text{stop}\to S \)
The available directions and their abbreviations are:
\( \text{left}\to L,\quad \text{right}\to R,\quad \text{forward}\to F,\quad \text{backward}\to B \)
For each command in the input, output the machine instruction which is the concatenation of the corresponding abbreviations. For a command with action \(a\) and direction \(d\), the output will be:
\( \text{output} = \text{action_mapping}[a] + \text{direction_mapping}[d] \)
If there are no commands, output nothing.
inputFormat
The first line contains an integer \( n \) representing the number of commands.
The following \( n \) lines each contain a command consisting of two words separated by a space.
Input is provided via standard input (stdin).
outputFormat
Output \( n \) lines where each line is the machine instruction corresponding to the input command. Output is printed to standard output (stdout).
## sample4
walk left
run forward
jump backward
stop right
WL
RF
JB
SR
</p>