My goal is to get the most repeated letter in a sentence or a line of strings (including spaces)
Here's the code I have so far
input = (str(input("Please enter a sentence:"))).strip()
b = list()
b.append(input.split())
counts = dict()
for word in b:
i = 0
while i < len(word):
counts[word[i]] = counts.get(word[i], 0) + 1
i += 1
print(counts)
At this point, I expect each and every letter to be in the dictionary with its values. But the output I get is (The input is "I want to do that" :
{'I': 1, 'want': 1, 'to': 1, 'do': 1, 'that': 1}
Instead of having individual letters with their values, I am getting the entire words
Can you guys please tell me the mistakes I made and so on?