Description
You need to read a line from the console and match everything that is in square brackets. However, there are some rules that you need to follow:
• You must have no whitespaces inside the match.
• Inside the match you must have [(ASCII Symbols)<(Some digits)REGEH(Some digits)>(ASCII Symbols)] • If you have nested brackets you need to match the inner most.
[asdSd[asdasd<4REGEH23>asdUsd]
After you find a match you must extract the numbers between the “<”, “>” brackets. Then use this number like index to get character from input. Every index is the sum of all previous indexes. When the index is larger than the string length start from the beginning of the string. Continue that process until you traverse the string enough times for the index to fit.
Input
Output
• You must print on the console a single line with characters, that you find in the string
Constraints
– Time limit: 0.3 sec. Memory limit: 16 MB.
Examples
Input Output
Soft
[a td Sd [asdasd<4REGEH22>asdo sy] ***oopprefs [ew<16REGEH30>rdt r]pppp555b
SoftUni!
[aаdSd
[asdasd<4REGEH22>asd o
<3 sy] ***oopprefs
REGEH1>fdwss] [ew<16REGEH30>rdt r]ppp555b
[t U <1REGEH15>s] trneti!t[dsaf
[atdSd[<4REGEH22>asdosy] ***oopprefs[ew<16REGEH>rdtr]pppp555b
[atdSd[<422>asdosy] ***oopprefs[ew<16REGEH>]pppp




Reviews
There are no reviews yet.