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

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


2008.G. 50264 - String Multiplication

Гость
• Обсуждение задачи (1)

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

• 2007.J. 50275 - Wedding
• 2007.K. 50276 - Nice Floor
• 2008.A. 50672 - Math and Soldiers
• 2008.B. 50261 - Roads
• 2008.C. 50262 - Brackets
• 2008.D. 50279 - Bit Decoder
• 2008.E. 50263 - Points
• 2008.F. 50972 - Division
• 2008.G. 50264 - String Multiplic...
• 2008.H. 50254 - Lawyers Council
• 2009.A. 50283 - Tetris 3D
• 2009.B. 50284 - Knights of the Rook
• 2009.C. 50285 - Meat store
• 2009.D. 50259 - Many-coloured roads
• 2009.E. 50266 - Kovrov
• 2009.F. 50267 - Interesting permutat...
• 2009.G. 50260 - What about judges?

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

Если у вас есть предложения или пожелания по работе 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.

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