15 August 2026
Run Report
Medium
Strings
Turn each uninterrupted run of letters into a short, readable count.
You are given a string of lowercase letters. Read it from left to right and group identical neighbouring letters into runs. Return a new string that writes each letter followed by the number of times it appears in its run. For example, "aaabbc" becomes "a3b2c1". Return an empty string when the input is empty.
Constraints
text contains only lowercase English letters.0 <= len(text) <= 500.Write a count for every run, including runs of length 1.
Function signature
def run_report(text: str) -> str: