DWITE '08 R3 #2 - Wordcount++

View as PDF

Submit solution

Points: 5
Time limit: 2.0s
Memory limit: 64M

Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig
DWITE Online Computer Programming Contest, December 2008, Problem 2

There's an essay due in class, and your teacher demands at least a certain minimum length from your paper. Caring more about optimization than the subject of ancient history, a wordcount tool would come in handy; and save you from writing any more words than you need to.

Knowing that your teacher counts only the words that are more than three letters long (having a similar software tool of her own), your program would need to do just that -- count the words that are at least 4 letters long.

The input will contain 5 lines, each a line of English text, no more than 255 characters in length.

The output will contain 5 integer values -- count of words over 3 letters long, in each line.

Sample Input

DWITE question number two: Wordcount++
Note how "two:" does not count.
For simplicity - "don't" is two words, split by apostrophe.

That was a blank line above.

Sample Output


Attribution-NonCommercial-ShareAlike 3.0 Unported (CC BY-NC-SA 3.0) Problem Resource: DWITE


  • 2
    maxcruickshanks  commented on July 1, 2020, 3:40 p.m. edited

    For anyone having trouble with this problem, words with contractions (e.g., one's, don't, I'll, etc.) are not considered words and punctuation marks (at the start or end of a word) are not considered characters that contribute to a word's length.