ZOJ Problem Set - 3074
B.B. has a rubik's cube and plays with it from time to time. A standard 3x3x3 Rubik's Cube has 6 coloured sides, 21 pieces and 54 outer surfaces which is shown below. It can be rotated to obtain a very large number of different configurations.
Now, B.B. has been tired with the cube and buys a pyraminx. A pyraminx is a special kind of rubik's cube, which looks like a pyramid. Fig-1 shows a pyraminx. A pyraminx can be rotated in 8 different ways: rotate clockwise 120° or counter clockwise 120° around one of the four vertexes. Fig-2 demonstrates the operations where '+' for clockwise and '-' for counter clockwise. Simply, we use 'A+' for rotating the pyraminx 120° clockwise around vertex 'A', and 'A-' for counter clockwise rotating around 'A'. Other vertexes perform in the same way.
B.B. is confused with the rotating and turns to you for help, calculate the results for her.
There are multiple cases. Each case starts with a string "START" in a line, followed by n (0 <= n <= 100) lines each containing an operation on the pyraminx. The last operation is followed by a line of string "END".
For each case, after all the operations performed on the new pyraminx shown in the left of Fig-1, print the four faces in the same order as shown in the right of Fig-1. Format the output as shown in sample output, use spaces to seperate characters, there are no trailing spaces. Use 'R' for red, 'G' for green, 'B' for blue and 'Y' for yellow.
Seperate cases with an empty line.
/G\ /B\ /R\ /G\G/G\ /Y\B/B\ /R\R/R\ /R\R/B\G/G\/Y\Y/Y\G/G\/B\B/B\B/B\ \R/R\R/Y\Y/ \G/Y\Y/ \Y/ /B\ /R\ /G\ /R\B/Y\ /B\R/Y\ /G\G/G\ /B\B/G\G/G\/Y\Y/Y\Y/Y\/G\G/B\Y/Y\ \R/R\R/B\B/ \B/R\R/ \R/
Author: GAO, Yuan
Source: ZOJ Monthly, December 2008