There's the classic run length encoding and decoding.
input output a3b2c5 aaabbccccc
And that's fairly straight forward and done before.
The challenge is to also account for a non-standard behavior when multiple characters precede the run length (a single digit from 0-9). Each character before the run length digit (the last digit before a non-digit or end of the string) has that value applied to it individually and printed out in order.
Some test input and output including some edge cases:
input output ab3c5 aaabbbccccc a0b3 bbb 13b1 111b a13b1 aaa111b a123b1 aaa111222b aa2a1b1 aaaaab
- A character sequence (
[a-zA-Z0-9]+) must be followed by its run length length (
- Only valid input needs to be considered (
- yes, empty string is valid input.
- Input is via standard input, output via standard output
This is code golf, number of bytes determines the winner.