Trains the technique from
LeetCode 345Reverse Vowels of a StringThis is an original problem, written from a brief that listed the technique, the difficulty, the topics, the function shape and the input bounds — none of that problem's wording, examples, hints or editorials. The link is there so you can map your practice onto the standard set.
Same function shape, different story and different numbers.
A theatre spells the evening listing on its marquee out of character tiles clamped along one rail. A tile sits in a loose socket when its character is a, e, i, o or u, written either as a capital or in lower case. Every other tile on the rail is riveted down and cannot be moved, whatever character it shows.
The stagehand lifts all of the loose tiles off the rail, holds them, and drops them back into exactly the same sockets, but working from the far end of the rail towards the near end. The upshot is that the loose tiles occupy the same positions as before with their order along the rail turned around, while every riveted tile is untouched. Tiles are never re-cut, so a capital tile stays a capital wherever it lands.
You are given the current marquee text as the string board, made of printable ASCII characters. Return the text the marquee shows once the stagehand steps back.
Example 1
Two tiles are loose, the capital in position 1 and the lower-case one in position 5. They trade sockets, and each keeps the case it was cut with.
Example 2
The four loose tiles sit in positions 2, 6, 8 and 10; reading them back to front gives the tiles that land in those same four positions. The space and every riveted tile stay put.
Example 3
Only one tile here is loose, so lifting it and dropping it back changes nothing. A tile showing the letter y is riveted like any other consonant tile.
The editor is preloaded with this. It matches the parent problem's shape, so a solution that works here transfers to a judge unchanged.
def marquee_vowel_sockets(board: str) -> str:public String marqueeVowelSockets(String board)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.