Policz częstotliwość znaków w ciągu
#count the frequency of a character in a string using a dictionary
s=input("enter string: ")
a={}
for i in s:
if i not in a:
a[i]=s.count(i)
else:
pass
print("frequency")
for ch in a:
print(ch,a[ch])
#output
enter string: hello world
frequency
h 1
e 1
l 3
o 2
1
w 1
r 1
d 1
Gr@Y_orphan_ViLL@in##