NumPy allowed · plain Python earns 10 bonus points
Encode repeated consecutive characters into character-count pairs, the cornerstone of lossless text and bitmap data compression.
Implement run_length_encode(text): walk through the string and replace each run of identical consecutive characters with the character followed by the count of repetitions. Return "" for an empty string.
run_length_encode(text: str) -> str