#3775

Reverse Words With Same Vowel Count

specialist · 625 · lc medium +29 · 66.6% accepted · 54 likes · top 72%

Description

Given a string s of space-separated lowercase English words, count the vowels in the first word, then reverse every subsequent word that contains the same number of vowels (leaving other words unchanged), and return the resulting string (vowels: 'a', 'e', 'i', 'o', 'u').

Code

1
2
3