Problem hidden
This problem was hidden by Editorial Board member probably because it has incorrect language version or invalid test data, or description of the problem is not clear.

H_KITTY - Hello Kitty (challenge)

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 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 le 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), (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


Added by:Piotr Kąkol
Date:2010-03-27
Time limit:3.983s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: SCM qobi
Resource:Copy of Daniel Gómez Didier's task Hello Kitty with different judge

hide comments
2013-10-18 00:23:30 Piotr KÄ…kol
Fixed. Sorry.
2013-09-24 21:05:17 vinayawsm
I am getting WA here whereas I got my solution accepted in practice problems (http://www.spoj.com/problems/HELLOKIT/). :(.
2011-04-26 09:54:34 Piotr KÄ…kol
@yxcv - strlen(W)<20
2011-04-25 15:45:09 anonymous
What's the maximum length for W?
2010-04-08 18:36:21 Piotr KÄ…kol
Maybe topcoder has worse tests. ;-)
I checked all Your WA's and You really have some mistakes in them. ;-)
2010-04-08 16:29:29 :(){ :|: & };:

Strange,my accepted strategy in topcoder gives WA here !
2010-04-02 11:31:39 Zoltán Zámbori
The "60" is because i must waste my time to experiments how the judge works. :-(
2010-04-02 10:15:17 Piotr KÄ…kol
It may be caused by the fact that You have array of 60 characters. And "The number is less than 10." so:
9*max_length<=60
max_length<=20/3
floor(20/3)=6 so max length of string in the input is for Your program 6. Change it to more and You will have only WA. ;-)
2010-04-02 08:42:51 Zoltán Zámbori
I tested the code again at home: the string length was 320, the repeat was 99. It is finished less than half seconds and produced ~10MB output.

How can i figure out why i get "time limit exceeded" message from the judge?


Last edit: 2010-04-02 09:07:05
2010-04-01 23:00:45 Piotr KÄ…kol
Test cases are ok.
They are also not so big.
Despite the fact I changed time limit to 10 sec You still get TLE (because I did rejugde) so it has not influence on Your TLE.

Last edit: 2010-04-01 23:01:27
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.