Module: (C++) Workshop - 4. String processing. "A little about Ancient Rome and Julius Caesar"


Problem

6 /6


Unpacking a line

Problem

Everyone knows that Caesar sometimes used cryptography, that is, a kind of cipher invented by himself.
Sometimes, to reduce writing time, Caesar used packing, the principle of which is to remove repeated letters and replace them with numbers that determine the number of repetitions.
We will consider only lines consisting of capital Latin letters. For example, consider the string AAAABCCCCCDDDD. This string can be represented as 4AB5C4D.
Write a program that takes a packed string and reconstructs the original string from it.
 

Input
The input contains one packed string. Only constructions of the form  nA, where n — the number of repetitions of a character (an integer from 2 to 99), and A — a capital Latin letter, or constructions of the form  A, that is, a character without a number that determines the number of repetitions. The maximum string length does not exceed 80.

Imprint
Output the recovered string. In this case, the line must be divided into lines of exactly 40 characters each (except for the last one, which may contain less than 40 characters).
 
Examples
# Input Output
1 ABC ABC
2 O2A3O2AO OAAOOOOAAO
3 A2B3C4D5E6F7G ABBCCCDDDDDEEEEEFFFFFFGGGGGGG