#K8721. Character Frequency Transformation
Character Frequency Transformation
Character Frequency Transformation
Given a string \(s\), transform it so that each unique character is immediately followed by its total frequency in \(s\). The order of characters in the output must follow the order of their first appearance in the input string. Formally, if a character \(c\) appears in \(s\) with frequency \(f(c)\), then it should appear as \(c\, f(c)\) in the output.
Example:
- Input: "aabbcc"
- Output: "a2b2c2"
Here, character a appears twice, b appears twice and c appears twice.
inputFormat
The input consists of a single line containing a non-empty string \(s\) composed of lowercase alphabetic characters.
Input Format: The string is provided via standard input.
outputFormat
Output a single string which is the transformed string where each unique character from the input is followed by its frequency count.
Output Format: Print the result to standard output.
## sampleaabbcc
a2b2c2