ÀÂÒ
Language: Russian
English

Remote Training on Programming

Problems Online status Contests
News FAQ E-learning
For authors:
Register  ||  Login
 
Hello, Guest! Please login or register.

614. String Multiplication

Time Limit: 2 seconds
Memory Limit:65536KB
Points:100
View Problem Statistics Submit Problem added debug

One can multiply not just numbers, but also strings. And almost anything, if the operation of multiplication is defined. In this problem we shall define the multiplication of two strings A = a1a2a3...an and B = b1b2b3...bm a new string C = a1b1a2b2a3b3...

For example, abc · defg = adbecfg, abcd · x = axbcd, abc · qwertyuiop = aqbwcertyuiop. If there are more than two strings in this operation, strings are multiplied sequentially from left to right. For example, ab · cd · ef = acbd · ef = aecfbd.

You are given a string S of length L, and N positive integer numbers k1, k2,..., kN whose sum is equal to L. Your task is to write a program that will represent the string S as a multiplication of N strings with lengths k1, k2,..., kN.

Input
In the first line an integer number N is written (2 ≤ N ≤ 1000). In the second line string S is written, which consists only of small Latin letters. Length of S is not less than two and no more than a thousand of symbols. In the third line N positive integer numbers follow, separated by a space: k1,..., kN. It is guaranteed that their sum is equal to length of S.
Output
In the first line of output file write the representation of the string S as needed (see the samples). Use asterisk as the symbol of multiplying. No spaces are allowed.

Input 1 Output 1 Input 2 Output 2
3
abracadabra
7 2 2
acdabra*ra*ba
4
test
1 1 1 1
t*t*s*e


View Problem Statistics Submit Problem discussion Author/source:
Problems from Contests and Camps / Kovrov contests / KIT-2008 /
609. Roads 614.
time generating 0.109 sec.
© Copyright VSU, AVT, Nosov D.A., Andrianov I.A.