#P15413. [CCC 2019 J4/S1] Flipper 翻转
[CCC 2019 J4/S1] Flipper 翻转
Problem Description
While waiting at the optometrist, you try to pass the time. You notice a grid containing four numbers:
You see many mirrors and lenses, so you wonder what happens if you flip this grid horizontally or vertically.
- One “horizontal flip” (flip along the horizontal center line) becomes:
- One “vertical flip” (flip along the vertical center line) becomes:
Your task is: after performing a sequence of horizontal and vertical flips, determine the final arrangement of the grid.
Input Format
The input is a single string, with length at least character and at most characters.
Each character is:
H— represents one horizontal flip.V— represents one vertical flip.
For out of points, the input length is at most characters.
Output Format
Output the final arrangement of the grid.
Print two lines, each with two integers, separated by one space.
HV
4 3
2 1
VVHH
1 2
3 4
Hint
Translation source: GPT 5.2.
Translated by ChatGPT 5