Welcome To SDIBT ACM-ICPC Online Judge

VIRTUAL JUDGE Recent Contest F.A.Qs Forum Home ProblemSet Status Ranklist Contest LoginRegister Exam
Problem 1999. -- Repeating Characters

Repeating Characters

Time Limit: 1 Sec  Memory Limit: 64 MB
Submit: 52  Solved: 36
[Submit][Status][Forum]

Description

For this problem, you will write a program that takes a string of characters, S, and creates a new string of characters, T, with each character repeated Rtimes. That is, Rcopies of the first character of S, followed by Rcopies of the second character of S, and so on. Valid characters for Sare the QR Code alphanumeric“ characters:

0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ$%*+-./:


Input

The first line input contains a single integer P(1<=P<=1000),which is the number of data set that follow. Each data set is a single line of input consisting of the data set number N, followed by a space, followed by the repeat count R,(1 <= R<= 8), followed by a space, followed by the string S. The length of string S always be at least one and no more than 20 characters. All the characters will be from the set of characters shown above.

Output

For each data set there is one line of output. It contains the data set number, N, followed by a single space which is then followed by the new string T, which is made of each character in Srepeated R times.

Sample Input

2
1 3 ABC
2 5 /HTP

Sample Output

1 AAABBBCCC
2 /////HHHHHTTTTTPPPPP

HINT

Source

Greater New York Region 2011

[Submit][Status][Forum]

HOME Back

한국어 中文 English
All Copyright Reserved 2008-2010 SDIBT TEAM
GPL2.0 2003-2010 HUSTOJ Project TEAM
Anything about the Problems, Please Contact Admin:admin