ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Сборники > Problems from everywhere > задача:


TopCoder-6. 50759 - Text Statistics

Гость
• Обсуждение задачи (1)

Задачи сборника

• Редкое имя
• KBH-1012. 50617 - КВН
• KBH-1013. 50618 - Коррекция кода
• TopCoder-1. 50761 - Magic Words
• TopCoder-2. 50246 - Making Potions
• TopCoder-3. 50245 - Santa Gifts
• TopCoder-4. 50701 - Cell Removal
• TopCoder-5. 50760 - Hexatridecimal...
• TopCoder-6. 50759 - Text Statis...
• TopCoder-7. 50244 - Chessboard P...
• TopCoder-8. 50641 - Strong Prime ...
• VologdaInterCity-A. 50614 - Игра в...
• VologdaInterCity-B. 50632 - Снова ...
• VologdaInterCity-C. 50646 - Чем бо...
• VologdaInterCity-D. 50605 - За реш...
• VologdaInterCity-E. 50624 - Проста...
• VologdaInterUni-A. 50628 - Матрица

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб. Сложность Альфа

Most modern text editors are able to give some statistics about the text they are editing. One nice statistic is the average word length in the text. A word is a maximal continuous sequence of letters ('a'-'z', 'A'-'Z'). Words can be separated by spaces, digits, and punctuation marks. The average word length is the sum of all the words' lengths divided by the total number of words.

For example, in the text "This is div2 easy problem". There are 5 words: "This"is"div"easy" and "problem". The sum of the word lengths is 4+2+3+4+7 = 20, so the average word length is 20/5 = 4.
Given a text, return the average word length in it. If there are no words in the text, return 0.0.

Input
The first line will contain the text of length between 0 and 50 characters inclusive. Text will contain only letters ('a'-'z', 'A'-'Z'), digits ('0'-'9'), spaces, and the following punctuation marks: ',', '.', '?', '!', '-'. The end of text will be marked with symbol '#' (see examples for clarification).
Output
Output should contain one number - the average length. The returned value must be accurate to within a relative or absolute value of 10-9.

Input 1 Input 2 Input 3
This is div2 easy problem.#
a bc#
w84lFC1hD2ot2?43 Jnw67Kmt8KhOQn#
Output 1 Output 2 Output 3
4.0
1.5
2.714285714

Для отправки решений необходимо выполнить вход.

www.contester.ru