#统计文本中字母的出现次数
s = """ASlumber Did My Spirit Seal
William Wordsworth
Aslumber did my spirit seal1;
Ihad no human fears:
She seemed a thing that could not feel
The touch of earthly years.
No motion has she now, no force;
She neither hears nor sees;
Rolled round in earth’s diurnal course
With rocks, and stones, and trees."""
dic =dict()
for i in s:
if i in ['a','r','f','p','h']:
if i in dic:
dic[i] +=1
else:
dic[i] =1
print(dic)