ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Сборники > Kovrov IT 2008 > задача:

G. String Multiplication

Задачи сборника

• A. Math and Soldiers
• B. Roads
• C. Brackets
• D. Bit Decoder
• E. Points
• F. Division
• G. String Multiplication
• H. Lawyers Council

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
Автор: Павел Кузнецов, ПГУ.

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.

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.
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
7 2 2
1 1 1 1

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