Given a string as input, you need to output how many times each letter appears in the string. You decide to store the data in a | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 2

Given a string as input, you need to output how many times each letter appears in the string. You decide to store the data in a

Given a string as input, you need to output how many times each letter appears in the string. You decide to store the data in a dictionary, with the letters as the keys, and the corresponding counts as the values. Create a program to take a string as input and output a dictionary, which represents the letter count. Sample Input hello Sample Output {'h': 1, 'e': 1, 'l': 2, 'o': 1}

20th Apr 2022, 2:49 PM
Alabi Ayodele
Alabi Ayodele - avatar
3 Answers
+ 2
Alabi Ayodele , can you please mention the programming language in tags? thanks!
20th Apr 2022, 2:50 PM
Lothar
Lothar - avatar
20th Apr 2022, 2:57 PM
Alabi Ayodele
Alabi Ayodele - avatar