Advertisement
horozov86

01. Count Chars in a String

Mar 20th, 2023
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.28 KB | None | 0 0
  1. words = input().split(" ")
  2.  
  3. dictionary = {}
  4. for word in words:
  5.     for letter in word:
  6.         if letter not in dictionary:
  7.             dictionary[letter] = 1
  8.  
  9.         else:
  10.             dictionary[letter] += 1
  11.  
  12. for key, value in dictionary.items():
  13.     print(f"{key} -> {value}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement