#PCBTAM0000003. Lặp lại văn bản (Repeat Text)
Lặp lại văn bản (Repeat Text)
Repeat Text
Version: Phuoc Hung OJ Extended
Problem Statement
Given a string and a nonnegative integer , construct the string consisting of consecutive, unchanged copies of . Do not insert separators between copies.
If or is empty, the resulting string is empty.
Input
The first line contains , which may be empty or have trailing spaces. The second line contains integer .
Output
Print the resulting string on one line. Print an empty line if the result is empty.
Subtasks
- Subtask 1 (100 points): ; ; .
Examples
Example 1
Input
ab
3
Output
ababab
Explanation. Three copies of ab give ab + ab + ab = ababab.
Example 2
Input
Hi
0
Output
Explanation. With , no copies are printed; the output is empty.
Example 3
Input
x
2
Output
x x
Explanation. Each copy of x includes a trailing space, so two copies produce x x .