#K58052. Command Translator

    ID: 30556 Type: Default 1000ms 256MiB

Command Translator

Command Translator

Given a string representing a sequence of commands, your task is to translate it into a list of actions. Each character in the string corresponds to a specific command. Additionally, any sequence enclosed within parentheses should be interpreted as a subsequence that is repeated twice.

The mapping is defined as follows:

  • \(A\) corresponds to Move Forward
  • \(B\) corresponds to Turn Left
  • \(C\) corresponds to Turn Right

For example, if the input is A(B), then the output should be:

Move Forward
Turn Left
Turn Left

Note that the sequence inside the parentheses is repeated twice. Implement the translation and output the resulting commands, each on a new line.

inputFormat

The input is provided via standard input (stdin) as a single line string that represents the sequence of commands. The string may be empty.

Examples:

A
A(B)

outputFormat

Output the corresponding commands to standard output (stdout), each command on a separate line. There should be no extra spaces or blank lines.

For instance, for the input A(B), the output should be:

Move Forward
Turn Left
Turn Left
## sample
A
Move Forward