Língua do Pê, or P Language, is a language game spoken in Brazil and Portugal with Portuguese. It is also known in other languages, such as Dutch and Afrikaans. (Wikipedia)
There are some dialects in this language game. The different languages the game is played with even have their own unique dialects. Some people are fluent in speaking P Language and the best can even translate any text to their preferred dialect on the spot!
P Language
In this challenge, we will use the Double Talk dialect.
To translate text into P Language, any sequence of vowels in the text is appended with a single p
character followed by a copy of the sequence of vowels.
Challenge
Write a function or program that accepts a string as input and outputs its translation in P Language.
- The input consists only of printable ASCII characters.
- The output consists only of the translated input and optionally a trailing newline.
- Vowels are any of the following characters
aeiouyAEIOUY
. - A sequence of vowels is delimited by any other character. The string
"Aa aa-aa"
has three vowel sequences. - Leading and trailing whitespace may optionally be omitted from the translated output string.
Examples
"" => ""
"Lingua do Pe" => "Lipinguapua dopo Pepe"
"Hello world!" => "Hepellopo woporld!"
"Aa aa-aa" => "AapAa aapaa-aapaa"
"This should be easy, right?" => "Thipis shoupould bepe eapeasypy, ripight?"
"WHAT ABOUT CAPS?" => "WHApAT ApABOUpOUT CApAPS?"
" Hi " => " Hipi " or "Hipi"
The double quotes character "
is used to delimit the input and output strings in the examples but obviously this character may also appear in any valid input string.