python怎么改才能让输出格式改成输出一行,首先是频次最高的那个单词,然后是它出现的次数,中间用空格分隔

txt=input()
for s in ',.\n ':
txt=txt.replace(s,' ')
txt=txt.lower()
list=txt.split()
count=dict()
for i in list:
count[i]=count.get(i,0)+1
sort=sorted(count.items(), key=lambda item:item[1],reverse=True)
print(sort)


txt=input()
for s in ',.\n ':
    txt=txt.replace(s,' ')
txt=txt.lower()
list=txt.split()
count=dict()
for i in list:
    count[i]=count.get(i,0)+1
sort=sorted(count.items(), key=lambda item:item[1],reverse=True)
print(sort[0][0],sort[0][1])

print(xxx, end=' ')可以实现输出不换行,需要换行的时候直接print()

望采纳, 谢谢!

txt=input()
for s in ',.\n ':
    txt=txt.replace(s,' ')
txt=txt.lower()
list=txt.split()
count=dict()
for i in list:
    count[i]=count.get(i,0)+1
sort=sorted(count.items(), key=lambda item:item[1],reverse=True)
for i in sort:
    for j in i:
        print(j,end=' ')