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
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. \$\endgroup\$