WC '17 Contest 2 J4 - Entish Translation

View as PDF

Submit solution

Points: 7 (partial)
Time limit: 1.0s
Memory limit: 16M

Author:
Problem type
Woburn Challenge 2017-18 Round 2 - Junior Division

The Ents of Fangorn Forest have all convened in order to vote on an important decision - should they go to war against the treachery of Saruman, or continue to mind their own business?

Merry and Pippin have managed to convince Treebeard, the oldest of the Ents, of the need to take action. As such, Treebeard has prepared a speech designed to convince the other Ents of the same. Unfortunately, he has written it in Old Entish, which is a decidedly unhasty language. The Hobbits suspect that it may take him weeks just to get through it! As such, they'd like to translate it into New Entish, a more compact version of the Ents' language.

The two Hobbits will translate one word at a time. They're taking a look at the first word in the Old Entish speech, which is a non-empty string with at most 100 characters. Each character is either a lowercase letter (a\dotsz), or a dash (-). Neither the first nor the last character is a dash, and there are never multiple consecutive dashes. The dashes divide the word up into one or more "tokens". In other words, each token is a maximal contiguous sequence of letters.

Translating a word from Old Entish into New Entish is a two-step process:

  1. In each token, for each contiguous sequence of consonants (letters aside from a, e, i, o, and u), reduce it down to just the first letter in that sequence.
  2. For each contiguous sequence of equal tokens, reduce it down to just a single copy of that token.

Please determine the result of translating the first word of Treebeard's speech into New Entish by applying the above process to it.

Input Specification

The first and only line of input consists of a single string, the word in Old Entish.

Output Specification

Output a single string, the word translated into New Entish.

Sample Input

a-lalla-lalla-rumba-kamanda-lindor-burume-burumne-byurstume-a-keema

Sample Output

a-lala-ruma-kamana-linor-burume-a-keema

Sample Explanation

For example, during the translation process, each of the 7^{th}, 8^{th}, and 9^{th} tokens initially gets reduced to burume. Then, only the first of these three equal consecutive tokens is retained.


Comments

There are no comments at the moment.