PROG0446 - Ubbi Dubbi

Ubbi Dubbi (also Pig Greek or Double Dutch in English, or Ububbubi Dububbubi in Ubbi Dubbi) is a language game that is popular with children. They use it as a secret language or as a joke. The language became popular thanks to the long-term television program ZOOM on PBS and one of its variants was used by Bill Cosby in his dentist sketch and for the voice-over he did for Mushmouth from the series Fat Albert and the Cosby Kids. However, the language goes back to the starting days of the American English in the 17th century.

The principle of Ubbi Dubbi is simple. English words are transformed by having a series of vowels preceded by ub. If the first vowel of the sequence is an uppercase letter, that vowel is preceded by Ub.

Assignment

  • Write a function text2ubbi to which an (English) sentence has to be given. The function should print that sentence translated to Ubbi Dubbi.
  • Write a function ubbi2text to which a sentence in Ubbi Dubbi has to be given. The function must print the original (English) sentence. 

Example

>>> text2ubbi('speak')
'spubeak'
>>> text2ubbi('Hello')
'Hubellubo'
>>> text2ubbi('Extra')
'Ubextruba'
>>> text2ubbi('Mississippi')
'Mubissubissubippubi'
>>> text2ubbi('zoom')
'zuboom'
>>> text2ubbi('Ubbi Dubbi')
'Ububbubi Dububbubi'
>>> text2ubbi('Hi, how are you?')
'Hubi, hubow ubarube yubou?'

>>> ubbi2text('spubeak')
'speak'
>>> ubbi2text('Hubellubo')
'Hello'
>>> ubbi2text('Ubextruba')
'Extra'
>>> ubbi2text('Mubissubissubippubi')
'Mississippi'
>>> ubbi2text('zuboom')
'zoom'
>>> ubbi2text('Ububbubi Dububbubi')
'Ubbi Dubbi'
>>> ubbi2text('Hubi, hubow ubarube yubou?')
'Hi, how are you?'

Ubbi Dubbi (ook Pig Greek of Double Dutch genoemd in het Engels, of Ububbubi Dububbubi in het Ubbi Dubbi) is een Engels taalspelletje dat vooral populair is bij kinderen. Die gebruiken het als geheimtaal of louter voor de grap. Het taaltje werd populair dankzij het langlopende televisieprogramma ZOOM op PBS en een variant ervan werd ook gebruikt door Bill Cosby in zijn tandartssketch en voor de stem die hij insprak voor het personage Mushmouth uit de reeks Fat Albert and the Cosby Kids. De taal gaat echter terug op de begindagen van het Amerikaans Engels in de 17e eeuw.

Het principe van Ubbi Dubbi is eenvoudig. Engelse woorden worden vervormd door elke reeks klinkers te laten voorafgaan door ub. Als de eerste klinker van de reeks een hoofdletter is, dan wordt die klinker omgezet naar een kleine letter en wordt de reeks voorafgegaan door Ub.

Opgave

  • Schrijf een functie tekst2ubbi waaraan een (Engelse) zin moet doorgegeven worden. De functie moet de zin vertaald naar Ubbi Dubbi teruggeven.
  • Schrijf een functie ubbi2tekst waaraan een zin in het Ubbi Dubbi moet doorgegeven worden. De functie moet de originele (Engelse) zin teruggeven.

Voorbeeld

>>> tekst2ubbi('speak')
'spubeak'
>>> tekst2ubbi('Hello')
'Hubellubo'
>>> tekst2ubbi('Extra')
'Ubextruba'
>>> tekst2ubbi('Mississippi')
'Mubissubissubippubi'
>>> tekst2ubbi('zoom')
'zuboom'
>>> tekst2ubbi('Ubbi Dubbi')
'Ububbubi Dububbubi'
>>> tekst2ubbi('Hi, how are you?')
'Hubi, hubow ubarube yubou?'

>>> ubbi2tekst('spubeak')
'speak'
>>> ubbi2tekst('Hubellubo')
'Hello'
>>> ubbi2tekst('Ubextruba')
'Extra'
>>> ubbi2tekst('Mubissubissubippubi')
'Mississippi'
>>> ubbi2tekst('zuboom')
'zoom'
>>> ubbi2tekst('Ububbubi Dububbubi')
'Ubbi Dubbi'
>>> ubbi2tekst('Hubi, hubow ubarube yubou?')
'Hi, how are you?'

Added by:Peter Dawyndt
Date:2014-01-20
Time limit:10s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:PY_NBC
Resource:None

© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.