Vyxal, 6 bytes
ĠvLʁf+
Ġ # Group runs of identical chars
vL # Length of each
ʁf # 0...n each and flatten
+ # Add to input
Port of caird coinheringaahing's answer
ĠvLʁf+
Ġ # Group runs of identical chars
vL # Length of each
ʁf # 0...n each and flatten
+ # Add to input
Port of caird coinheringaahing's answer