Text Statistics
Most modern text editors offer statistical insights about the text being edited. One useful statistic is the average word length. A word is defined as the longest continuous sequence of alphabetic characters ('a'-'z', 'A'-'Z'). Words are separated by spaces, digits, and punctuation marks. The average word length is calculated by dividing the total length of all words by the number of words.
For instance, in the text "This is div2 easy problem", there are 5 words: "This", "is", "div", "easy", and "problem". The total length of these words is 4+2+3+4+7 = 20, resulting in an average word length of 20/5 = 4.
Write a program to calculate the average word length for a given text. If the text contains no words, assume the average word length is 0.
Input
The input consists of a single line of text, ranging from 0 to 50 characters in length. The text includes only alphabetic characters ('a'-'z', 'A'-'Z'), digits ('0'-'9'), spaces, and the punctuation marks: ',', '.', '?', '!', '-'. The text ends with the character '#' (refer to examples for clarification).
Output
The output should be a single number representing the average word length, displayed with a precision of 9 decimal places.