Intern — Middle
String compression using Run-Length Encoding algorithm
livecode
Task condition
It is necessary to write a function that takes a string and returns its representation after applying the Run-Length Encoding (RLE) algorithm. Consecutive identical characters are replaced with the character followed by the number of its repetitions. A character that appears only once is left without adding a number. For example, the string AAAABBCCXYZDDDDEEEFFFAAAAABBBBBBBBBBBBBBBBBBBBBBBB should be transformed into A4B3C2XYZD4E3F3A6B28.