HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Strings > problem:


50264 - String Multiplication

Guest
• Discussion of problem (1)

Section problems

• 50908 - Buy 1 Get 1
• 50761 - Magic Words
• 50760 - Hexatridecimal Sum
• 50759 - Text Statistics
• 50246 - Making Potions
• 50258 - String manipulations
• 50264 - String Multiplication
• 50307 - Palindromes
• 50315 - Pig Latin
• 50484 - Number Of Letters
• 50323 - Filtering Contact List
• 50409 - Random Password Generator
• 50763 - Valid Password
• 50429 - Secret Message
• 50511 - Class Average

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
Автор: Павел Кузнецов, ПГУ.

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

Для отправки решений необходимо выполнить вход.

www.contester.ru