Programming contests

ECN selejtező programozó csapatverseny, 2018. április 21.

April 21, 2018 10:15 AM – April 21, 2018 3:15 PM

Gretchen at Her Spinning-Wheel

Gretchen [at her spinning-wheel, alone].
My peace is gone,
– My heart is sore –
I'll find it, ah, never,
No, nevermore!
When he is not near,
My grave is here;
My world is all
Turned into gall.

As Gretchen is deeply thinking of Faust, she turns her spinning-wheel constantly. Indeed, she turns the spinning-wheel after every x syllables. How many times did she turn the spinning-wheel?

You may assume all single vowels (a, e, i, o, u, and y) and adjoining vowels are one syllable (e.g., “find” and “head” have one syllable). If “e” is at the end of a word and has no adjoining vowel, then it is silent (e.g., “peace” has one syllable). Here are some examples: “you” has one syllable, “only” has two syllables, and “hmm” has no syllables. You may also ignore all apostrophes (e.g., “I've” and “I'll” both have one syllable).

Input Specification

The input starts with a line containing x, the number of syllables for each turn. Then it will contain a nonempty text passage. The passage ends when a line contains only the word “END” (all uppercase). All lines will have no more than 75 characters.

Output Specification

Output a line containing the number of turns Gretchen made to her spinning-wheel. If the passage does not contain a multiple of x syllables, Gretchen will turn once more at the end. For example, if x = 5, and there are 100 syllables, she will turn 20 times; if there are 101 syllables, she will turn 21 times.

Sample Input

  1. 5
  2. My peace is gone,
  3. - My heart is sore -
  4. I'll find it, ah, never,
  5. No, nevermore!
  6. When he is not near,
  7. My grave is here;
  8. My world is all
  9. Turned into gall.
  10. END
download as text file

Output for Sample Input

  1. 7
download as text file
University of Debrecen; Faculty of Informatics; v. 03/01/2019