#PCBTAM0000014. Lặp chuỗi ở hai phía (Repeat on Both Sides)
Lặp chuỗi ở hai phía (Repeat on Both Sides)
Repeat on Both Sides
Version: Phuoc Hung OJ Extended
Problem Statement
Given a string and a nonnegative integer , construct the left part by concatenating copies of and construct the right part in the same way. Print the left part, one vertical bar |, and then the right part.
Do not insert spaces between copies. The separator is always inserted, even when or is empty.
Input
The first line contains , which may be empty. The second contains integer .
Output
Print one line consisting of copies of , the | separator, and another copies of .
Subtasks
- Subtask 1 (100 points): ; .
Examples
Example 1
Input
ab
2
Output
abab|abab
Explanation. Two copies of ab produce abab on either side of |.
Example 2
Input
X
0
Output
|
Explanation. At , both sides are empty but the | separator remains.
Example 3
Input
a
2
Output
a a |a a
Explanation. Each copy of a ends in a space; two copies on each side preserve these spaces near | and at the end.