Requirements
In this task, we’d need to find the occurrences of every character in the String value.
Additionally, we’d have to follow some rules. Here is the list:
- The algorithm should be case-insensitive. In other words, we’d treat the upper-case and lower-case representations of the letter as it’s the same.
- Next, the algorithm should write the total number of characters in the console.
- Lastly, we should write the total occurrence number for each letter in the console as well.
Input:
String myString = "I love summer nights"
Output:
String has 20 characters, 3 whitespaces.
Character occurrence:
e - 2
g - 1
h - 1
i - 2
l - 1
m - 2
n - 1
o - 1
r - 1
s - 2
t - 1
u - 1
v - 1
Send Us Your Solution
If you’re interested in our feedback, please send us your solution here. We’ll review it and let you know.
[contact-form-7 404 "Not Found"]