Woburn Challenge 2017-18 Round 2 - Junior Division
Problem 4: Entish Translation
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
".."z
"), 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:
- 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. - 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 Format
The first and only line of input consists of a single string, the word in Old Entish.
Output Format
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 7th, 8th, and 9th tokens initially gets reduced to "burume
". Then, only the first of these three equal consecutive tokens is retained.
All Submissions
Best Solutions
Point Value: 7 (partial)
Time Limit: 2.00s
Memory Limit: 16M
Added: Feb 23, 2018
Author: SourSpinach
Languages Allowed:
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3
Comments (Search)
-amagicalsoup