<PREV Problem:
NEXT>
Solved by 17 users: old1, Rizvanov, tourist, WsemirZ, dan, Chmeli_BSU, zloy_mipt, JohnJones_001, mazahaka, defrager, Jacob, ilyakor, topspin, UdH-WiNGeR, EAA2008, Dest, fetetriste.
UserDateAttemptTimeCMSC
Rizvanov14 feb 2008C++600.35496 
old110 dec 2006C++400.70565 
defrager22 mar 2009Kylix300.16584 
WsemirZ05 sep 2008Kylix500.16584 
WsemirZ05 sep 2008Kylix300.16593 
Jacob27 mar 2009C++800.81594 
WsemirZ05 sep 2008Kylix200.16613 
WsemirZ05 sep 2008Kylix100.16637 
defrager22 mar 2009C++400.16687 
fetetriste01 may 2014C++1000.27687 
EAA200815 mar 2010C++100.18775 
JohnJones_00102 nov 2008C++201.33792 
ilyakor11 apr 2009C++1300.16798 
Chmeli_BSU18 oct 2008C++2800.34805 
Languages
C++
13
Kylix
4
Java
1
 > 
 > 
 > 
 > 
 > 
 > 
 > 
 > 
 > 
 > 

The Landing

Time limit = 2 second(s)

There was a string of simbols "." and "-", but some symbols was missed and changed to "0" symbol. You know resulting string and lenghts of all substrings consisting of symbols "-" given in order from left to right For string "-.---...--" length list will be (1, 3, 2). Your task is to restore maximum amount of missed symbols.

Input

First line contains string from symbols ".", "-", "0", string lenght does not exceed 10000. The second line contains length list.

Output String with maximum symboles restored or word "BEAVERROR" if information is contradictory.

Input#1
.-0.-
2 1

Output#1
.--.-

Input#2
000 
2

Output#2
0-0

Input#3
..
1 
Output#3
BEAVERROR

Author:
First Moscow Individual Programming Championship, 17 October 2004, MIPT

<PREV | Problem set | Search related messages | NEXT>


© acm.mipt DevGroup
The page was generated in 210ms

SW soft NIX
ID = 3.230.154.129