#C9385. Taco Dance Moves
Taco Dance Moves
Taco Dance Moves
You are given a string that represents a sequence of dance moves performed by a robot. Each character in the string is a command. The only valid commands are L
, R
, J
, and C
. If the command string contains any other character, the execution is considered invalid.
Mathematically, let \( s \) denote the input command string. The function \( f(s) \) is defined as:
\( f(s) = \begin{cases} s, & \text{if } s \subseteq \{L, R, J, C\} \\ "Invalid move!", & \text{otherwise} \end{cases} \)
The input consists of a single line, and the output should be printed to standard output (stdout). If all the moves in the string are valid, print the string itself; otherwise, print "Invalid move!".
inputFormat
The input is provided via standard input. It consists of a single line containing the command string.
outputFormat
The output should be printed via standard output. If every character in the command string is one of the valid moves (L
, R
, J
, C
), print the input string. Otherwise, print "Invalid move!".
LRJJC
LRJJC