#K6291. String Compression

    ID: 31636 Type: Default 1000ms 256MiB

String Compression

String Compression

You are given a string s consisting of lowercase English letters. Your task is to compress the string using run-length encoding. For each maximal group of consecutive identical characters in s, if the length of the group is 1, simply append the character; if the length is greater than 1, append the character followed by the count. Formally, if a character c appears consecutively k times, it should be encoded as:

$$ c \; (\text{if } k = 1) \quad \text{or} \quad c\,k \; (\text{if } k > 1) $$

For example, if s = "aabcccaaa", the compressed string is a2bc3a3.

inputFormat

The input consists of a single line containing the string s (with 0 \leq |s| \leq 10^5). The string will only contain lowercase English letters.

outputFormat

Output a single line — the compressed version of the given string.

## sample
aabcccaaa
a2bc3a3