MWC '15 #2 P1: Symmetry

View as PDF

Submit solution

Points: 3
Time limit: 2.0s
Memory limit: 64M

Author:
Problem types

MathBunny123 loves to play around with letters. He even has his own signature pattern. It is as follows: given a sequence of N letters,

  • On the first line, print each letter from left to right X times, X being the position of the letter (the first letter is at position 1), then going from the second last letter to the first letter, print each letter X times.
  • On the next \frac{N^2-1}{2} lines, replace the (i+1)^\text{th} letter from the left and right of the previous line in the pattern with the first letter.
  • The rest of the pattern should contain \frac{N^2-1}{2} lines which make the entire pattern symmetrical vertically.

Input Specification

The input will contain one line with a sequence of letters, not separated by spaces. There will be N (3 \le N \le 9) letters, and N will be odd.

Output Specification

Output MathBunny123's signature pattern using the given letters.

Sample Input

ABC

Sample Output

ABBCCCBBA
AABCCCBAA
AAACCCAAA
AAAACAAAA
AAAAAAAAA
AAAACAAAA
AAACCCAAA
AABCCCBAA
ABBCCCBBA

Comments

There are no comments at the moment.