Given a
string of characters, this string can be written in compressed form, identifying
repeating subsequences; the repeated sequence will be written only once in the
compressed string, and will be contained within round brackets, followed by
the number of repetitions.
E.g: string xaaaaaabababab will
be written in compressed form as x(a)5(ab)4.
The compression rule can also apply inside brackets.
E.g.: string CCCCHCCCCHIIIIIIIIIIN
can be written in compressed form as ((C)4H)2(I)10N
Task
Write a program that reads a compressed string and determines the initial string.
Input Data
Input file compress.in contains on the first line the compressed string.
Output Data
Output file compress.out will contain a single line with the initial string on it.
Constraints and Statements
compress.in | compress.out |
((C)4H)2(I)10N |
CCCCHCCCCHIIIIIIIIIIN |
Time limit: 0.1 seconds/test
prof. Emanuela Cerchez
Computer Science High
Schol "Grigore Moisil" Iasi
Contact:emanuela.cerchez@gmail.com