text; the first player moves first.
- On their turn, the first player cuts out any non-empty contiguous piece that contains an **odd** number of vowels.
- The second player cuts out any non-empty contiguous piece that contains an **even** number of vowels (zero counts as even).
The remaining parts of the string are joined back together. Whoever cannot move loses. The vowels are a, e, i, o, u.
Both players play optimally. Return True if the first player wins, and False otherwise.text='planet' → True
There are two vowels. The first player cuts pla (one vowel), leaving net. The second player must cut a piece with an even number of vowels, say n. The first player takes the whole et, and the second player has no move left.
text='rhythm' → False
There are no vowels, so the first player has nothing to cut and loses immediately.
text='aei' → True
text consists of lowercase English letterstext='planet'
True
Run checks the first 3 tests in your browser. Submit checks all 123 tests on the server, hidden ones included.