Олимпиадный тренинг

Задача 38190. Number of words


Задача

Темы: Строки
The input of the program receives a line of text, which may contain:
— uppercase and lowercase (i.e. large and small) Latin letters;
— spaces;
— punctuation marks: dot, comma, exclamation point and question mark;
— the character –, which in some cases stands for a dash, and in some cases — hyphen.
The word — is a sequence of consecutive Latin letters and hyphens, bounded at both ends. The beginning of a line, the end of a line, a space, a punctuation mark, a dash can act as delimiters. A dash differs from a hyphen in that letters are written to the left and to the right of the hyphen, and at least one side of the dash is either the beginning of a line, or the end of a line, or a space, or some kind of punctuation mark, or another dash.
Write a program that determines how many words are in a given line of text.

Input
A string of no more than 200 characters is entered.

Imprint
Print one number — the number of words that are contained in the source string.
 
Examples
# Input Output
1 Hello world! 2
2 www.olympiads.ru 3
3 Gyro-compass - this is a ... 4