Wordsworth
started by: JGatJGat
on: 1210583295|%e %b %Y, %H:%M %Z|agohover
number of posts: 1
rss icon RSS: new posts
summary:
A nice starter problem - not too hard, not too easy. From ProgComp '03
Wordsworth
JGatJGat 1210583295|%e %b %Y, %H:%M %Z|agohover

You are to write a program which will work out the value of a piece of text. It is to do this by counting the number of letters in each word in the text.

The text is a list of words, separated by at least one spaces, possibly together with some punctuation and/or line breaks. The length of each word corresponds to a digit in the "value", with a word of length 10 corresponding to the digit 0. There is to be a decimal point after the first digit.

For example the phrase "How I need a monkey" has words of length 3, 1, 4, 1 and 6 respectively. This is worth 3.1416 (coincidentally this is pi to 4 decimal places).

You are to write a program which, given such a message, returns its value.

You may assume that there are between two and sixty words in the message, and that no word is longer than ten letters. You may also assume that the input will all be on one line of text, and each word will have at least one letter.

Sample Input Sample Output
But a time I spent wandering in bloomy night yon towers 3.1415926536
By fleeing a dinosaur in Slovakia, a dinosaur in Slovakia made escape! 2.71828182846
S. Wordsworth 1.0
last edited on 1210629715|%e %b %Y, %H:%M %Z|agohover by JGat + show more
unfold Wordsworth by JGatJGat, 1210583295|%e %b %Y, %H:%M %Z|agohover
new post
Unless stated otherwise Content of this page is licensed under Creative Commons Attribution-NonCommercial 3.0 License