+ 1
Count number of letters in a String
How to count number of letters in string.....for example input = hello and output = {'h':1,'e':1,'l':2,'o':1} in JAVA
3 Answers
+ 6
Learn about Map Interface. You can make it as
* declaring map
* by a single loop , add each character to map , character as key, and value as it's count.
* desplay Or output map.
+ 4
You can make an array of size 26 for storing all alphabet letters
make a for loop to iterate in the input string
And add 1 to the index of each number