Under construction

Still being built. Things may change

Counting Words

Interview

Time limit2sMemory limit1024 MB

Summary
Split a sentence on spaces and hyphens, then split any token that looks like a French contraction (c', j', n', m', t', s', l', d', qu' followed by a vowel) into two words, and count the total.
Level

Easy3 of 10

Topics
String, Implementation, Simulation, Brute force
Solved
No attempts yet

Problem

Kipa is learning French. French does not perfectly separate words by spaces alone.

  • By default, words are separated by spaces or hyphens (-).
  • If the preceding word is ce, je, ne, me, te, se, le, la, de, que, or si and the following word begins with a vowel (a, e, i, o, u, h), the last vowel of the preceding word disappears and an apostrophe (') is attached instead, joining them.
    • In French, h is always silent, so note that in this problem, h is treated as a vowel as well as the commonly known vowels a, e, i, o, u.

For example, je means "I", aime means "(I) like", and (les) pommes means "apples". To form the French sentence "I like apples" from these words, you write j'aime les pommes. Because the preceding word is je and it met the following word's vowel a, the e disappeared and an apostrophe was attached instead. So Kipa, a French beginner, decided to split French sentences into words this way.

  • First, split "words" by spaces and hyphens (-).
  • For each "word", if it could have been contracted as above (that is, if it starts with c', j', n', m', t', s', l', d', or qu' and the character after the apostrophe is a vowel), split these words once more.

But on reflection, this process need not apply only to French sentences!

Given an arbitrary string, write a program that finds how many words result when word units are formed according to Kipa's idea.

Input

The first line gives a string representing a "sentence". This string consists only of lowercase English letters, spaces, hyphens (-), and apostrophes ('). No two of spaces, hyphens, and apostrophes are adjacent, and none appear at the start or end of the sentence.

Output

Print how many words result when the input "sentence" is split into words according to Kipa's idea.

Constraints

  • The "sentence" is a string of length between 1 and 5,000.
  • The "sentence" consists only of lowercase English letters, spaces, hyphens (-), and apostrophes (').
  • No two of spaces, hyphens, and apostrophes are adjacent, and none appear at the start or end of the sentence.

Examples1

  1. Example 1

    Input
    qu'est-ce qu'il mange aujourd'hui
    
    Expected output
    7