#C5579. Run-Length Encoding
Run-Length Encoding
Run-Length Encoding
You are given a non-empty string consisting of lowercase letters. Your task is to encode the string using Run-Length Encoding (RLE). In RLE, consecutive occurrences of the same character are replaced by the character followed by the number of its repetitions. For a group of consecutive characters c repeated n times, the encoded part is represented as $$c n$$ (without any space). For example, the string aaabbcaa
is encoded as a3b2c1a2
.
inputFormat
The input is read from standard input (stdin) as a single line containing the string to be encoded. The string consists of lowercase letters and its length is at least 1.
outputFormat
Output the run-length encoded string as a single line to standard output (stdout).## sample
aaabbcaa
a3b2c1a2