Determine if String Halves Are Alike
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
2 <= len(s) <= 100len(s)is even
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More Strings problems
- Find Words Containing CharacterBeginner
- Join the Non-Empty PartsBeginner
- Longest Vowel RunBeginner
- Longest Word in a SentenceBeginner
- Maximum Nesting Depth of ParenthesesBeginner
- Mirror CipherBeginner
- One Segment of OnesBeginner
- Percentage of Letter in StringBeginner