시간 제한메모리 제한제출정답맞힌 사람정답 비율
8 초 (추가 시간 없음) 512 MB0000.000%

문제

A wooden block is standing on a large board with one-inch squares. The block is one inch deep, two inches wide and four inches tall. First, the block is sitting on exactly two squares. The top of the block is black, the bottom is white, the front is green, the back is red, the left face is blue, and the right face is yellow.

Then the block is moved to a new location on the board by being rolled. The block is rolled in such a way that one edge is always in contact with a line of the board at all times. The block never slides.

There are four basic operations that can be performed on the block: F (rolling the block forward), B (backwards), L (to the left), and R (to the right).

Figure 1: The rolling cubes

The diagram shows the original position of the block (center) and the aspect but not the exact board location of the block after each of the four basic operations.

Your task is to write a program that outputs the resulting state of the block, given a sequence of basic operations.

입력

The input contains a series of data sets. Each data set consists of a single line that contains a string of up to 1000 letters from the set ‘F’, ‘B’, ‘L’, and ‘R’.

출력

For each data set, your program should follow the given sequence of basic operations, then print the new location of the front left corner of the block relative to the original location and the colors on the front, left, and top of the block. The output by your program should imitate the sample output below.

예제 입력 1

FRBL

예제 출력 1

x: -2, y: 0, front: yellow, left: black, top: red