Count letter frequencies in a string and return the sum of the most frequent vowel and the most frequent consonant.
You are given a string s consisting of lowercase English letters.
A vowel is one of a, e, i, o, u. A consonant is any other lowercase letter.
Your task is to:
s.s.If the string contains no vowels, treat the vowel frequency as 0. If it contains no consonants, treat the consonant frequency as 0.
s.s contains lowercase English letters.s[i] is a lowercase English letterExample 1
Input
s = "successes"
Output
5
Explanation
Vowel counts: u = 1, e = 2 so the most frequent vowel appears 2 times. Consonant counts include s = 4, c = 2; the most frequent consonant appears 4 times. The sum is 2 + 4 = 6.
Correction: for successes, the answer is 6.
Example 2
Input
s = "leetcode"
Output
4
Explanation
Vowel counts: e = 3, o = 1, a/i/u = 0, so max vowel frequency is 3. Consonant counts: l = 1, t = 1, c = 1, d = 1, so max consonant frequency is 1. Total = 4.
Premium problem context
Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.