Copodope Gopolopfop
Retina, 9 bytes
(?!\G)op
Try it online!
Instead of checking that the preceding character is a consonant, we just make sure that the current op
is not adjacent to either the beginning of the string or the previous match. The only case where we could match an incorrect op
is if the original string contained an op
(resulting in opop
). But in that case we'll just remove the first op
instead of the second and the result will be the same.
Python, 42 bytes
lambda s:re.sub('(.)op',r'\1',s)
import re
Try it online!
If I'm not mistaken, you can just substitute all ?op
with ?
without caring about vowels. If the original string contains op
, then it's oppified to opop
, and the replacement returns it to op
and no further. This is because the pattern matches for ?op
cannot overlap, so only one op
is removed.
A non-regex solution is 5 bytes longer.
Python, 47 bytes
f=lambda s:s and s[0]+f(s[1+2*(s[1:3]=='op'):])
Try it online
V, 12, 5 bytes
Í.“op
Try it online!
00000000: cd2e 936f 70 ...op
Saved 7 bytes thanks to @Xnor's realization that since the input must always be opped, we don't have to check for vowels.