python代码修改 统计不同长度的单词个数

问题遇到的现象和发生背景

统计不同长度的单词个数,以列表格式输出

问题相关代码,请勿粘贴截图
import string
a=input()
for i in string.punctuation:
    a=a.replace(i,'')
a=a.split(' ')
b=sorted(a,key=len,reverse=False)
c=[len(i) for i in b] #c=[2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 7, 7, 7, 9, 11, 11]
e=[]
for j in c:
    if j not in e:
        x={j:0}
    x[j]=x[j]+1
    e.append(x)
print(e)

运行结果及报错内容

img


运行结果是这样的,我想要做到[(2,4),(3,6),(4,2)]这样