Run-length encoding


Run-length encoding, is a form of data compression in which a data string of consecutive characters (e.g. "QQQWWWTTTK") are stored as a count and the associated character (e.g. "3Q3W3T1K").

Build a function that can take a single string input and return the run-length encoded equivalent.


Access restricted

Subscribe to premium account to see the solution.

Get premium now