1580 - Rubik
Time Limit : 1 Second
Memory Limit : 128 MB
Submission: 97
Solved: 18
- Description
- ELT is not a clever boy, he is too dumb to play a third-order rubik. So he bought a two-order rubik. Look the picture below to see what is a two-order rubik.
Of course, a restored two-order rubik has six faces: Front face with color Red; Behind face with color Orange, Up face with color Yellow; Down face with color White; Left face with color Blue; Right face with color Green.
ELT likes rotating rubik. In each rotate, he chooses a face first, and rotate 90 degrees clockwise or counterclockwise. Of course, you should look at that face when you rotate. Now he gives you the rotating sequence he made, can you guess the final color of each squares on these six faces?
- Input
- The first line of input file contains the total cases in the file.
Each case just contain a number N and a string of length N, 1 <= N <= 100, each character in string represents a rotation. U/u means Up face; D/d means Down face; F/f means Front face; B/b means Behind face; L/l means Left face; R/r means Right face. Upper case letters indicate rotating clockwise, and lower case letters indicate rotating counterclockwise.
- Output
- For every test case in the input file, the output should contain a format as "Case #X: ", where X is case number(starting from 1), and then print the color of each square. The sequence of the 24 squares are marked by 1, 2, 3...... in the picture below. You should print square 1 first, and then square 2, and so on.
Please use R to represent Red, O to represent Orange, Y to represent Yellow, W to represent White, B to represent Blue and G to represent Green.
- sample input
-
3 1 u 2 FF 4 RlrL
- sample output
-
Case #1: YYYYBBRRGGOOOOBBRRGGWWWW Case #2: YYWWRRRROOOOBGBGBGBGYYWW Case #3: YYYYRRRROOOOBBBBGGGGWWWW
- hint
- source
- Kangqi LUO