High School Programming League 2011/2012

Caterpillars

Problem code: HS11CTPR

There are two kinds of caterpillars: vertical and horizontal ones.

A vertical caterpillar looks like this:

###  [ --- here the first segment starts  
..#  [ --- here the first segment ends  
###
#
     [ --- the rest depends on the caterpillar's height 
#..
###
..#

While a horizontal caterpillar looks like this:

#.##[ middle segments of ].###.
#.#.[    a horizontal    ].#.#.  
###.[     caterpillar    ]##.##

Print a caterpillar according to a given specification.

Input data specification

Input consists of one letter V for vertical caterpillars or H for horizontal ones and an integer 2 < n < 20 - the caterpillar size in segments.

Output data specification

Caterpillar as in the example below.

Example 1

Input:
V3

Output:
###
..#
###
#..
###
..#

Example 2

Input:
H6

Output:
#.###.###.##
#.#.#.#.#.#.
###.###.###.

Scoring

By solving this problem you score 10 points.


Added by:Łukasz Kuszner
Date:2011-09-13
Time limit:1s
Source limit:50000B
Languages:All except: SED AWK ICK
Resource:High School Programming League
SPOJ System © 2010 Sphere Research Labs. All Rights Reserved.