Занятие 11. Словари

Задача «Номер появления слова»


Условие

В единственной строке записан текст. Для каждого слова из данного текста подсчитайте, сколько раз оно встречалось в этом тексте ранее.

Словом считается последовательность непробельных символов идущих подряд, слова разделены одним или большим числом пробелов или символами конца строки.


Во всех задачах считывайте входные данные через input() и выводите ответ через print().


Войти или зарегистрироваться, чтобы отправлять решения на проверку

Тесты

Входные данные Правильный ответ Что вывела программа Результат
one two one tho three
0 0 1 0 0
She sells sea shells on the sea shore; The shells that she sells are sea shells I'm sure. So if she sells sea shells on the sea shore, I'm sure that the shells are sea shore shells.
0 0 0 0 0 0 1 0 0 1 0 0 1 0 2 2 0 0 0 0 1 2 3 3 1 1 4 0 1 0 1 2 4 1 5 0 0
aba aba; aba @?"
0 0 1 0
AA aa Aa aA
0 0 0 0
a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
a b a c a b a d a b a c a b a
0 0 1 0 2 1 3 0 4 2 5 1 6 3 7
dsgsdf ' sdfg gdf ghgh sdfg sdh ghhfgjgj sdfg fhdh dfh dfh dfh
0 0 0 0 0 1 0 0 2 0 0 1 2
word
0
Lady of luck come out of your hiden course bless your light upon me as the light of the moon shines above and in the light of luck will be blessed i, when the moon is next to be full
0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 2 1 0 0 0 0 0 2 2 3 1 0 0 0 0 0 3 1 0 0 0 1 0
As I prick this candle, I prick at thee Broken hearts unhappy be May you part another day Soon to go your separate ways
0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
you will not solve this test. This @[email protected] is unsolvable.
0 0 0 0 0 0 0 0 0 0
dfs bfs dejkstra bubble sort floid kmp z-function kormen bfs dejkstra bubble sort qsort merge sort heap sort genetic algorythm
0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 2 0 3 0 0
Little girl, little girl Why are you crying? Inside your restless soul your heart is dying Little one, little one Your soul is purging Of love and razor blades Your blood is surging Runaway From the river to the street And find yourself with your face in the gutter Your a stray for the salvation army There is no place like home When you got no place to go Little girl, little girl Your life is calling The charlatans and saints of your abandon Little one little one The sky is falling The lifeboat of deception is now sailing In the wake all the way No rhyme or reason Your bloodshot eyes Will show your heart of treason Little girl little girl You dirty liar You're just a junkie Preaching to the choir Runaway To your lost tranquility And find yourself with your face in the gutter Your a stray for the dregs of humanity There is no place like home When you got no place to go The traces of blood Always follow you home Like the Mascara tears From your getaway Your walking with blisters And running with shears So unholy. Sister of grace. Runaway From the river to the street And find yourself with your face in the gutter You're a stray for the salvation army There is no place like home When you got no place to go
0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 0 1 1 0 0 0 0 0 0 1 0 2 0 0 0 0 0 0 1 0 0 0 0 0 2 0 0 2 0 2 0 0 0 3 0 0 0 3 0 0 0 0 0 1 0 1 1 1 0 2 1 2 1 3 0 4 0 0 0 1 0 0 3 0 3 1 3 2 1 0 5 0 2 0 1 0 6 0 0 0 4 0 0 5 0 0 0 0 0 4 0 0 0 0 4 1 2 0 4 2 4 3 0 0 0 0 0 1 0 0 2 6 0 1 0 5 0 0 1 1 1 1 6 1 1 7 1 5 2 1 1 8 0 3 0 1 7 2 2 1 1 1 2 1 3 3 3 1 3 0 4 1 0 0 3 2 0 9 0 0 1 7 0 6 0 2 0 2 0 3 0 0 0 0 5 0 2 2 10 1 4 11 1 3 2 2 4 8 2 2 12 2 1 3 2 2 13 1 1 2 8 4 4 2 3 2 4 2 5 5 5 2