Decoding and Expanding Strings
-
Read a string of interleaving digits and alphabets, while the first
character is always a digit, and the ending character is always an
alphabet [A-Za-z].
- For each group of <digit><alphabet>, this program
will expand it by repeating a number of the same alphabet, as
specified
by the digit.
- For example, "1A2B" will be expanded to "ABB", while
"3q"
will be expanded as "qqq".
Your program may run as follows:
Please input a string (e.g. "1A2B") -- 1A2B
ABB
Please input a string (e.g. "1A2B") -- 3q
qqq
Please input a string (e.g. "1A2B") -- 4Q593K7R
QQQQ99999KKKRRRRRRR