Sum of Occurrences
Bob was given a strange task by his teacher today:
Given a string consisting of lowercase letters, find the sum of occurrences of each letter.
Bob got too confused to solve this task. Can you do it for Bob instead?
Input Specification
The first line of the input will contain an integer \(N\) \((1 \le N \le 10^7)\), indicating the length of the string
The next line of the input is a string consisting of lowercase alphabet letters.
Output Specification
Output an integer, representing the sum of occurrences for all letters in the string.
Sample Input
5
hello
Sample Output
5
Sample Explanation
- The letter
h
appears once. - The letter
e
appears once. - The letter
l
appears twice. - The letter
o
appears once.
Overall this results in \(1 + 1 + 2 + 1 = 5\).
Comments