Description
Given a string s and a character letter, return the percentage of characters in s that equal letter rounded down to the nearest whole percent.
Examples
Input:
s = "foobar", letter = "o"Output:
33Explanation:
2/6 = 33%.
Input:
s = "jjjj", letter = "k"Output:
0Explanation:
The letter 'k' does not appear in the string at all, so 0% of characters match.
Input:
s = "programming", letter = "g"Output:
18Explanation:
The letter 'g' appears 2 times in "programming" (11 characters total). 2/11 ≈ 0.1818, so floor(18.18%) = 18%.
Constraints
- •
1 ≤ s.length ≤ 100