Skip to main content
2 of 4
deleted 49 characters in body
emanresu A
  • 44.4k
  • 5
  • 101
  • 240

Vyxal, 6 bytes

ĠvLʁf+

Try it Online!

Ġ      # Group runs of identical chars
 vL    # Length of each
   ʁf  # 0...n each and flatten
     + # Add to input

Port of caird coinheringaahing's answer

emanresu A
  • 44.4k
  • 5
  • 101
  • 240