15
3
The Language: Oppification
A funny language to speak is created by applying the following process to each word:
- Place
op
after each consonant. SoCode
becomesCopodope
.
Yes, that's it. For the purpose of this challenge, y
is always a consonant.
The Challenge: De-oppification
Given an oppified word, return the original word. Input will only contain letters. The first letter may be capitalized. The original word will never be empty and will always contain a vowel.
Test Cases:
Oppified -> Original
a a
I I
itop it
opop op
Opop Op
popopop pop
Copopop Cop
opopopop opop
Kopicopkop Kick
Asopia Asia
soptopopop stop
hopoopopsop hoops
hopoopopedop hooped
ooooohop oooooh
aaaopopaaa aaaopaaa
Popopopsopicoplope Popsicle
gopaloplopopopinopgop galloping
aopopbopopopcopopop aopbopcop
8None of your test cases contain a vowel followed by
op
, so an answer along the lines ofreplace(/(.)op/, '\1')
won't fail any of them. I suggest that you add a word likehoop
orlooped
to the test cases. – Doorknob – 2017-06-05T19:35:56.670@mbomb007 I added some more tricky test cases. – xnor – 2017-06-05T20:09:40.970
Does the answer only have to work for preoppified inputs or all inputs? – CalculatorFeline – 2017-06-06T02:51:42.483
@CalculatorFeline "Given an oppified word" – mbomb007 – 2017-06-06T04:21:46.863
Actually, all the people I know who speak this for fun agree that you add an "op" only right before a vowel sound. Code => Copode, Benji => Bopenjopi. – BenjiWiebe – 2017-06-06T05:41:34.627
2Can we add "mopmopmopbopopop" as a test case? :) – user2390246 – 2017-06-06T07:31:25.157
@Doorknob I think that approach also works correctly for those test cases, doesn't it? – Martin Ender – 2017-06-06T07:41:07.717
@BenjiWiebe I'll run that by the person who told me. – mbomb007 – 2017-06-06T13:32:09.680
WikiHow states "Some Oppish speakers insist on an “opp” after every single consonant, so the word, “flip” would be spelled, “f-opp l-opp i -p-opp.”" – mbomb007 – 2017-06-06T13:40:07.723