Actually, the RLE (Run Length Encoding) compression method is probably the simplest data compression algorithm in which repeated characters (series, i.e. sequences consisting of several identical characters) are replaced by the single character and the number of its repetitions.
- start from the first character
- add it to the result string
- count the number of repetitions of a character and add this number to the result string
- take the next character and repeat until the end of the original string
Example: the string “aaaabbbccd” after encoding the repetitions turns into the string “a4b3c2d1”, so instead of 10 characters we get 8. Compression is obvious!
The calculator below compresses the input string using the RLE method, and also displays the lengths of the original and resulting strings and the rate of data compression in percents.