#C309. String Run-Length Encoding
String Run-Length Encoding
String Run-Length Encoding
Given a string s consisting solely of lowercase English letters, your task is to encode the string using run-length encoding. In run-length encoding, each contiguous group of the same character is replaced by the character followed by the number of times it appears consecutively.
Formally, if the string s can be represented as $$ s = c_1^{k_1} c_2^{k_2} \dots c_n^{k_n}, $$ then the encoded string is $$ Encoded\ String = c_1k_1c_2k_2 \dots c_nk_n. $$
For example, the encoding of "aaabb" is "a3b2".
inputFormat
The input consists of a single line containing the string s composed of lowercase English letters (a-z
).
outputFormat
Output a single line representing the run-length encoded version of the input string.
## samplea
a1