FunctionRacerProblemsRace

Run-Length Decode

EasyStringsPython, JavaScript, TypeScript, Java, C++

s is made of pairs: a lowercase letter followed by a count written as one or more digits. Expand each pair into that letter repeated count times, and return the whole string. An empty s gives an empty string.

Example 1

s "a3b1c2"
returns "aaabcc"

aaa + b + cc.

Example 2

s "x12"
returns "xxxxxxxxxxxx"

The count may have several digits.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More Strings problems