CCC '15 J3 - Rövarspråket

View as PDF

Submit solution


Points: 5 (partial)
Time limit: 2.0s
Memory limit: 256M

Problem type
Canadian Computing Competition: 2015 Stage 1, Junior #3

In Sweden, there is a simple child's game similar to Pig Latin called Rövarspråket (Robbers Language).

In the CCC version of Rövarspråket, every consonant is replaced by three letters, in the following order:

  • the consonant itself;
  • the vowel closest to the consonant in the alphabet (e.g., if the consonant is d, then the closest vowel is e), with the rule that if the consonant falls exactly between two vowels, then the vowel closer to the start of the alphabet will be chosen (e.g., if the consonant is c, then the closest vowel is a);
  • the next consonant in the alphabet following the original consonant (e.g., if the consonant is d, then the next consonant is f) except if the original consonant is z, in which case the next consonant is z as well.

Vowels in the word remain the same. (Vowels are a, e, i, o, u and all other letters are consonants.) Write a program that translates a word from English into Rövarspråket.

Input Specification

The input consists of one word entirely composed of lowercase letters. There will be at least one letter and no more than 30 letters in this word.

Output Specification

Output the word as it would be translated into Rövarspråket on one line.

Sample Input 1

joy

Output for Sample Input 1

jikoyuz

Sample Input 2

ham

Output for Sample Input 2

hijamon

Comments


  • -1
    akhballett  commented on Feb. 8, 2024, 6:25 p.m.

    This one made my brain explode. But that wasfun


  • -1
    Peter2023  commented on Jan. 18, 2024, 5:02 p.m.

    I like this one.


  • -5
    iamaperson133769420  commented on May 22, 2022, 8:21 p.m.

    This comment is hidden due to too much negative feedback. Show it anyway.


    • -2
      Odin  commented on Dec. 27, 2022, 7:54 p.m.

      y can be a vowel sometimes, but thats too much of a hassle in code. like the rule to if or if not it's a vowel is really weird...


  • 4
    d  commented on Jan. 1, 2022, 7:57 p.m.

    A pangram has been added to the test data, and all submissions were rejudged.


  • -4
    nrushanthsuthaharan  commented on Jan. 1, 2022, 3:41 p.m.

    does anyone know what test case 5 is?


    • 5
      Spitfire720  commented on Jan. 1, 2022, 5:45 p.m.

      If you input zzz your program breaks, try that


  • 34
    risperss  commented on Nov. 19, 2020, 7:52 p.m.

    I think it should be mentioned that the nearest vowel does not wrap around the alphabet. 'y' is 2 positions away from 'a' and 4 away from 'u' but it considers 'u' to be closer since it does not have to wrap around to the beginning.


    • -2
      kopichiki  commented on Aug. 15, 2022, 9:17 p.m.

      yeah that part confused me.