

You are given a string s. Your task is to calculate the frequency of each character present in the string and print the results.
The output must follow these specific rules:
1) The character counting is case-sensitive (e.g., 'a' and 'A' are considered different characters). 2) Any spaces (' ') in the input string must be ignored. 3) The final frequencies must be printed in alphabetical order of the characters.The first line of input contains a single string s.
For each unique character (excluding spaces) found in the string, print a new line in the format: char: count
The lines must be sorted alphabetically by the character.
Alphabetical order refers to the standard character sort order (also known as ASCIIbetical order), where uppercase letters come before lowercase letters, and numbers/symbols have their own standard positions.
Hello World
H: 1
W: 1
d: 1
e: 1
l: 3
o: 2
r: 1
After ignoring the space, the characters are H, e, l, l, o, W, o, r, l, d.
The frequencies are: H(1), e(1), l(3), o(2), W(1), r(1), d(1).
Printed in alphabetical (ASCII) order, this gives the specified output.
Programming is fun
P: 1
a: 1
f: 1
g: 2
i: 2
m: 2
n: 2
o: 1
r: 2
s: 1
u: 1
The character 'r' appears twice, 'g' appears twice, 'm' appears twice, 'i' appears twice, and 'n' appears twice. All other characters appear once. The output is sorted by the character.
The expected time complexity is O(N log K), where N is the length of the string and K is the number of unique characters.
0 <= length of s <= 10^5
The string consists of standard ASCII characters.
Time limit: 1 sec
The expected time complexity is O(N log K), where N is the length of the string and K is the number of unique characters.