You are playing the original Super Mario Bros and you would like to record how to complete every level. You write down the sequence of actions:
walk, walk, jump, shoot, jump, jump, walk.
To save space, you can simplify the sequence to:
W2 J1 S1 J2.
Write a program that reads in a command per line (e.g.
W2) and prints out the full description (
walk walk). You can assume that the maximum number of repeated actions is 3 (
W3 is accepted, but
W4 is not). The
X marks the end of the input.