#K84747. Run-Length Encoding
Run-Length Encoding
Run-Length Encoding
Given a string, compress it using the run-length encoding algorithm. In run-length encoding, consecutive occurrences of the same character are replaced by a single instance of the character followed by the count of repetitions. For example, the string "aaabccddd" is encoded as "a3b1c2d3".
Your task is to implement the algorithm that transforms an input string into its run-length encoded form.
The encoding process can be formally described as follows: For a given string \(S\) of length \(n\), if a character \(S[i]\) repeats consecutively for \(k\) times, it is replaced by \(S[i]k\) in the encoded string.
inputFormat
The input is read from standard input and consists of a single string.
outputFormat
Output to standard output the run-length encoded version of the input string.
## sampleaaabccddd
a3b1c2d3