Given a non-empty string of lowercase ASCII letters a-z
, output that string with each consecutive “run” of the same letter lengthened by one more copy of that letter.
For example, dddogg
(3 d
’s, 1 o
, 2 g
’s) turns into ddddooggg
(4 d
’s, 2 o
’s, 3 g
’s).
This is code-golf: the shortest answer in bytes wins.
Test cases
aabbcccc -> aaabbbccccc doorbell -> ddooorrbbeelll uuuuuuuuuz -> uuuuuuuuuuzz q -> qq xyxyxy -> xxyyxxyyxxyy xxxyyy -> xxxxyyyy