#C278. String Compression

    ID: 46133 Type: Default 1000ms 256MiB

String Compression

String Compression

Given a string (s), compress it using run-length encoding. For each group of consecutive identical characters (c) repeated (k) times, output (c) if (k = 1), otherwise output (c) immediately followed by (k). For example, the string aaabbcc should be compressed to a3b2c2.

inputFormat

The input consists of a single line containing the string (s). The string can be empty and consists of lowercase letters.

outputFormat

Output the compressed string according to the described run-length encoding method.## sample

aaabbcc
a3b2c2