TORONTO KIDS COMPUTER CLUB | Aurora Monday 18:30 Python Homework 20.07.13.
17955
post-template-default,single,single-post,postid-17955,single-format-standard,ajax_fade,page_not_loaded,,no_animation_on_touch,qode-theme-ver-7.6.2,wpb-js-composer js-comp-ver-6.10.0,vc_responsive

# Aurora Monday 18:30 Python Homework 20.07.13.

## 17 Jul Aurora Monday 18:30 Python Homework 20.07.13.

Question:

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

1 2
3 4

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:

3 4
1 2

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

2 1
4 3

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

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

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

Sample Input 1
HV
Output for Sample Input 1
4 3
2 1

Sample Input 2
VVHH
Output for Sample Input 2
1 2
3 4

##### No Comments

Sorry, the comment form is closed at this time.