#C12365. Run-Length Encoding Compression
Run-Length Encoding Compression
Run-Length Encoding Compression
You are given a string s. Your task is to compress the string using the Run-Length Encoding (RLE) method. In RLE, consecutive occurrences of the same character are replaced by the character followed by the number of times it appears consecutively. For example, if a character c occurs k times consecutively, it is encoded as ck
(in LaTeX: $$c\;k$$).
Example:
Input: "aaabbc"
Output: "a3b2c1"
Implement the encoding function to produce the compressed string for the given input.
inputFormat
The input consists of a single line containing the string s which needs to be compressed. The length of s can be zero.
outputFormat
Output the RLE compressed string.
## sampleaaaa
a4