#K59347. Decompress Compressed String
Decompress Compressed String
Decompress Compressed String
You are given a compressed string which consists of integers and tokens of the form number*count
. In this format, a token like 3*2
represents that the integer 3 should appear 2 times in the decompressed sequence. A token without a '*' represents a single occurrence of that number.
Your task is to decompress the string and output the resulting sequence of integers in the order they appear, separated by a single space.
Example: For the input 3*2 1 4*3 2
, the output should be 3 3 1 4 4 4 2
.
inputFormat
The input consists of a single line containing the compressed string. Each token is separated by whitespace. Tokens are either a single number or of the form number*count
.
Read the input from stdin
.
outputFormat
Output the decompressed sequence of integers in a single line, with each integer separated by a single space. Write the output to stdout
.
1 2 3
1 2 3