DMOPC '15 Contest 7 P2 - Not a Wall of Text

View as PDF

Submit solution


Points: 3 (partial)
Time limit: 2.0s
Memory limit: 64M

Author:
Problem type

After seeing the first problem, you are probably very angry at the fact that you wasted a lot of time reading. For this problem, you should just count the number of words you have to read in a text. That's it. No tricks, no hidden catches. For the purposes of this problem, a word is any maximal contiguous group of non-whitespace characters.

Input Specification

The input will be a text with only lowercase letters and spaces (ASCII code 32). You should count how many words there are. The only constraint is that the length of the entire text will not exceed 80 characters (because nobody likes essays). Also, there won't be anything tricky like double whitespace in a row, leading whitespace, or trailing whitespace because we don't roll like that. In fact, we won't even give you a trailing newline to deal with.

Output Specification

Output the number of words in the text.

Sample Input

problem one is really long

Sample Output

5

Comments


  • 0
    esir_a3  commented on Nov. 5, 2025, 9:42 p.m.

    I'm new to this. Why did including a user prompt text inside the input fuction call cause me to get a zero score? Deleting the user prompt got me a perfect score. The prompt didn't negatively affect the output in my IDE's.


    • 1
      Kirito  commented on Nov. 6, 2025, 6:12 p.m.

      The "user prompt" is part of your program's output. The judge only checks your output against what it's expecting, it doesn't make any attempt to differentiate what is a "user prompt".