HELLOKIT - Hello Kitty

no tags 

Kitty sends a kind of original email messages to her friend Garf. To write a message, she
chooses a word W and a number n and replicates W n times horizontally. Then she repeats this
string in the next line, but rotating the characters once to the left. And she repeats this 'rotate-
and-output' process until the word W appears displayed as the fi rst column of the rectangular
pattern that she produces.
As an example, when she chooses the word Hello and the number 3, she gets the pattern:


HelloHelloHello
elloHelloHelloH
lloHelloHelloHe
loHelloHelloHel
oHelloHelloHell


Kitty has been sending such emails during the last three years. Recently, Garf told her that
perhaps her work may be automatized with a software to produce Kitty's patterns. Could you
help her?

Input

The input contains several test cases, each one of them in a separate line. Each test case
has a word and a positive integer that should generate the corresponding rectangular pattern.
The word is a string of alphabetic characters (a..z). The number is less than 10.
A line whose contents is a single period character means the end of the input (this last line
is not to be processed).

Output

Output texts for each input case are presented in the same order that input is read. For each
test case the answer must be a left aligned Kitty pattern corresponding to the input.

Example

Input:
Love 1
Kitty 2
.

Output:
Love
oveL
veLo
eLov
KittyKitty
ittyKittyK
ttyKittyKi
tyKittyKit
yKittyKitt

hide comments
Mohamed Ramzy: 2010-04-22 18:29:41

what output of MaM as example , i think that what gives me Worng Answer ??

Buda IM (retired): 2010-04-18 21:27:48

is the ( "." ) termination of input.

SANDEEP: 2010-04-06 16:29:43

what is output for input xyx 2

GS: 2010-01-01 17:44:29

I suppose there is some mistake in question....... it is not less than 10....

( may be <= 10 ).....

Seshadri R: 2009-12-23 08:18:41

What is the upper limit on the length of input text?

GS: 2009-12-14 17:02:33

Are u sure the number is less than 10???....

Last edit: 2009-12-14 17:02:56

Added by:Daniel Gómez Didier
Date:2009-10-31
Time limit:0.209s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64 NODEJS OBJC PERL6 SQLITE VB.NET