You are given a string compressed that represents a compressed string format where each character is followed by its frequency.
Create a better compression of the string such that:
Each distinct character appears exactly once.
The characters are arranged in alphabetical order.
Each character is directly followed by the sum of all its frequencies from the original string.
Return the better compressed string.
Constraints:
compressed.length
compressed consists only of lowercase English letters and digits.
compressed is a valid compression, where each character is followed by its frequency.
Frequencies are in the range
You are given a string compressed that represents a compressed string format where each character is followed by its frequency.
Create a better compression of the string such that:
Each distinct character appears exactly once.
The characters are arranged in alphabetical order.
Each character is directly followed by the sum of all its frequencies from the original string.
Return the better compressed string.
Constraints:
compressed.length
compressed consists only of lowercase English letters and digits.
compressed is a valid compression, where each character is followed by its frequency.
Frequencies are in the range