#K43882. String Compression
String Compression
String Compression
Given a string s, your task is to compress it by replacing every group of consecutive identical characters with the character followed by the number of occurrences. For example:
Input: aaabbbcccc Output: a3b3c4
If a character appears only once, it should still be followed by 1. For instance:
Input: abcd Output: a1b1c1d1
This problem requires you to perform run-length encoding on the input string.
inputFormat
The input is provided via standard input (stdin) as a single line containing the string s to be compressed.
Constraints: The string can consist of uppercase and lowercase letters. The length of the string is at least 1 and can be reasonably large.
outputFormat
Output the compressed version of the string to standard output (stdout).
## sampleaaabbbcccc
a3b3c4