As you all know, German has umlauts. They're these things:
However, most keyboards don't have an umlaut key. That's fine, though, because you can write
- Your job is to to replace
ue(and likewise for their capital versions).
- You have to deal with both the combining diacritical mark and single characters. (Thank you @ETHProductions for pointing this out.)
- Capitalization of the base letter stays intact.
- Capitalization of the
edepends on the capitalization of the surrounding letters after replacement. You should write it as
eunless it's adjacent to a capital letter on both sides, in which case write it as
E. (End of line and space are not capital letters.)
- Standard loopholes and I/O rules apply.
- This is code-golf, so shortest code in UTF-8 bytes wins!
Example Input and Output
Test cases using precomposed characters
ü = ue üb = ueb üB = ueB Ü = Ue Üb = Ueb ÜB = UEB
Test cases using combining diacritics
ö = oe öb = oeb öB = oeB Ö = Oe Öb = Oeb ÖB = OEB