eolymp
bolt
Try our new interface for solving problems
Problems

Repeating Characters

Repeating Characters

For this problem, you will write a program that takes a string of characters, \textbf{S}, and creates a new string of characters, \textbf{T}, with each character repaeated \textbf{R} times. That is, \textbf{R} copies of the first character of \textbf{S}, followed by \textbf{R} copies of the second character of \textbf{S}, and so on. Valid characters for \textbf{S} are the QR Code "alphanumeric" characters: \textbf{0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z \$ \% * + - . / :} \InputFile The first line of input contains a single integer \textbf{P} (\textbf{1} ≤ \textbf{P} ≤ \textbf{1000}), which is the number of data sets that follow. Each data set is a single ling of input consisting of the data set number \textbf{N}, followed by a space, followed by the repeat count \textbf{R} (\textbf{1} ≤ \textbf{R} ≤ \textbf{8}), followed by a space, followed by the string S. The length of string \textbf{S} will always be at least one and no more than \textbf{20} characters. All the characters will be from the set of characters shown above. \OutputFile For each data set there is one ling of output. It contains the data set number \textbf{N}, followed by a single space which is then followed by the new string T, which is made of each character in \textbf{S} repeated \textbf{R} times.
Time limit 1 second
Memory limit 64 MiB
Input example #1
2
1 3 ABC
2 5 /HTP
Output example #1
1 AAABBBCCC
2 /////HHHHHTTTTTPPPPP
Source 2011 Greater New York Regional