Question: Write a function expand _ string ( compressed _ str ) to expand a compressed string ( compressed _ str ) made up of characters
Write a function expandstringcompressedstr to expand a compressed string compressedstr made up of characters followed by digits.
The compressed string consists of characters followed by digits, where each digit represents the number of times the preceding character should be repeated. For example, abc should be expanded to "aaabbc".
Note:
The input string compressedstr will consist of English alphabet letters case sensitive and digits.
A character will be followed by one or more digits.
The function should correctly expand the compressed string by repeating each character according to the digits that follow it
The function should return the expanded string.
It is assured that lencompressedstr
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
