시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 512 MB 132 78 44 59.459%

문제

You are trying to pass the time while at the optometrist. You notice there is a grid of four numbers:

You see lots of mirrors and lenses at the optometrist, and wonder how flipping the grid horizontally or vertically would change the grid.

Specifically, a "horizontal" flip (across the horizontal centre line) would take the original grid of four numbers and result in:

A "vertical" flip (across the vertical centre line) would take the original grid of four numbers and result in:

Your task is to determine the final orientation of the numbers in the grid after a sequence of horizontal and vertical flips.

입력

The input consists of one line, composed of a sequence of at least one and at most 1000000 characters. Each character is either H, representing a horizontal flip, or V, representing a vertical flip.

For 8 of the 15 available marks, there will be at most 1000 characters in the input.

출력

Output the final orientation of the four numbers. Specifically, each of the two lines of output will contain two integers, separated by one space.

예제 입력 1

HV

예제 출력 1

4 3
2 1

예제 입력 2

VVHH

예제 출력 2

1 2
3 4