SDE Path

Count Words in a Line

Easy

Count Words in a Line

Count how many words appear in a line of text.

Input format

A single line S of words separated by single spaces.

Output format

Print how many words appear in S.

Constraints

  • Values fit in a 64-bit signed integer
  • Trailing whitespace and a trailing newline are ignored by the judge

Read from stdin, write to stdout. Sample cases below show the exact format.

Sample cases

Example 1
Input
the sky is blue
Expected output
4
Example 2
Input
hello
Expected output
1