Counting words in a string
PHP
Easy
strings
Task «Counting words in a string»
Write a program that takes a string and counts the number of words in it. A word is considered a sequence of characters separated by one or more spaces. The string may contain only letters of the Latin alphabet and spaces. The length of the string does not exceed 1000 characters.
Input Format
One line containing arbitrary text consisting of letters and spaces.
Output Format
One integer — the number of words in the string.
Examples
Example 1
INPUT
hello world
OUTPUT
2
Example 2
INPUT
one two three four five
OUTPUT
5
main.php