FunctionRacerProblemsRace

Determine if String Halves Are Alike

BeginnerStringsPython, JavaScript, TypeScript, Java, C++

s has an even length. Split it into a first half and a second half of equal length. The halves are alike if they have the same number of vowels (a e i o u, either case). Return True if they are alike, otherwise False.

Example 1

s "book"
returns true

bo and ok each have one vowel.

Example 2

s "textbook"
returns false

text has 1 vowel, book has 2.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More Strings problems