RZSCSRVC - Secret Service Agent

You all know about famous secret service agent Masud Rana. Masud Rana is a fictional character created in 1966 by writer Qazi Anwar Hussain. Today he is going to send a message to his colleague Shohana Chowdhury in encrypted format.

He likes letter R very much, so he encrypt a massage s in following pattern with height h (always odd).

If his massage is s = “ABCDEFGHIJKLMNOPQRSTUVWXYZ” and h = 5

Then his message will be like this:

EFG#RST

D#H#Q#U

CJI#PWV

BK##OX

A#LMN#YZ

That’s mean result format have height h=5, and all letter will be in sequentially make big R. All other space will be fill up with #. Please see the following figure for better understanding.

 

(Line has drawn for explanatory purpose )

Input

In first there is two integer n (1 <= n <= 1000) and h (1 <= h <=n, h is odd), length of the message and height of output. In next line there is a message s, message is a non-empty string consist with only capital letter.

Output

Print h line with corresponding answer with describe format.

Note that, there should not have any extra # after last letter of each line.

Example 1

Input:
13 3
PHQGHUMEAYLNA

Output:
QG#YL
HH#AN
PUMEA

Example 2

Input:
22 5
MXWTPTTTYKDUYVXJBZHQUP

Output:
PTT#ZHQ
T#T#B#U
WKY#J#P
XD##X
M#UYV

Example 3

Input:
22 7
MXWTPTTTYKDUYVXJBZHQUP

Output:
TTYK
T##D
P##U
TXVY
WJ###P
X#B##U
M##ZHQ

[ This problem originally contributed by Reajul Haque Reayz, CSE, CoU ]


Added by:Avik Sarkar
Date:2018-07-14
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All
Resource:Own

hide comments
2018-11-29 11:03:27 Jacob Plachta
According to my submission, H is always odd.
2018-10-14 17:12:36 :D
Re: Blue Mary

How to print out the output for even h?
2018-08-02 17:47:40
@psetter can you check my submission id 22085644. I dont know again why always WA. Thanks before

Last edit: 2018-08-02 17:51:20
2018-07-30 06:38:55 [Rampage] Blue.Mary
For at least one test data, h is not odd.
2018-07-27 12:43:45
please give the details specification of exact path of the big R character

Last edit: 2018-07-27 14:20:17
2018-07-16 20:46:22
It's been long since I've written something this ugly, elated to get AC without needing to debug my hideous code. My kind of problem nevertheless, thanks.
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.