+ 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

16th May 2023, 6:49 AM
Kiruthik Kumar
Kiruthik Kumar - avatar
2 Respuestas
+ 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.
16th May 2023, 7:09 AM
Jayakrishna 🇮🇳
+ 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
16th May 2023, 6:55 AM
Ugulberto Sánchez
Ugulberto Sánchez - avatar