15 lines
266 B
Python
15 lines
266 B
Python
#!/usr/bin/python3
|
|
|
|
phrase = str(input("Entrez une phrase : "))
|
|
tab = phrase.split(' ')
|
|
cpt_mot = {}
|
|
for mot in tab:
|
|
if mot in cpt_mot:
|
|
cpt_mot[mot] = cpt_mot[mot] + 1
|
|
else:
|
|
cpt_mot[mot] = 1
|
|
for key in cpt_mot.keys():
|
|
print(key, " ", cpt_mot[key])
|
|
|
|
|