String compression using the rule of consecutive groups

Rust Hard strings

Task «String compression using the rule of consecutive groups»

Given a string consisting of lowercase Latin letters. It is necessary to implement a string compression algorithm: if a group of identical characters with a length greater than 1 occurs in the string, this group is replaced by the character and the number of repetitions (the number is written without leading zeros). If a group consists of a single character, it remains unchanged. Output the resulting compressed string. The length of the original string does not exceed 10^5.

Input Format

The input is a single string S, consisting of lowercase Latin letters (a-z). The length of the string is from 1 to 10^5.

Output Format

Output one line — the compressed version of the original string.

Examples

Example 1

INPUT
abc
OUTPUT
abc

Example 2

INPUT
aabbaa
OUTPUT
a2b2a2

Example 3

INPUT
97 98 99 97 98 99
OUTPUT
97 98 92 97 98 92
main.rs