6 kyu
Consonant value
5,964 of 19,422KenKamau
Description:
Given a lowercase string that has alphabetic characters only and no spaces, return the highest value of consonant substrings. Consonants are any letters of the alphabet except "aeiou"
.
We shall assign the following values: a = 1, b = 2, c = 3, .... z = 26
.
For example, for the word "zodiacs", let's cross out the vowels. We get: "z o d ia c"
"zodiac" -> 26
The consonant substrings are: "z"
, "d"
and "c"
with values "z"
= 26, "d"
= 4 and "c"
= 3. The highest is 26.
"strength" -> 57
The consonant substrings are: "str"
and "ngth"
with values "str"
= 19 + 20 + 18 = 57 and "ngth"
= 14 + 7 + 20 + 8 = 49. The highest is 57.
For C: do not mutate input.
More examples in test cases. Good luck!
If you like this Kata, please try:
Strings
Fundamentals
Similar Kata:
Stats:
Created | Sep 23, 2017 |
Published | Sep 25, 2017 |
Warriors Trained | 36089 |
Total Skips | 6427 |
Total Code Submissions | 76215 |
Total Times Completed | 19422 |
JavaScript Completions | 5964 |
Python Completions | 6320 |
Ruby Completions | 565 |
Haskell Completions | 228 |
C# Completions | 1019 |
C Completions | 664 |
NASM Completions | 31 |
CoffeeScript Completions | 15 |
Crystal Completions | 22 |
PHP Completions | 464 |
TypeScript Completions | 728 |
Go Completions | 695 |
Dart Completions | 487 |
C++ Completions | 1042 |
Java Completions | 1639 |
Elixir Completions | 80 |
Groovy Completions | 7 |
Total Stars | 534 |
% of votes with a positive feedback rating | 94% of 2272 |
Total "Very Satisfied" Votes | 2016 |
Total "Somewhat Satisfied" Votes | 231 |
Total "Not Satisfied" Votes | 25 |
Total Rank Assessments | 11 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 7 kyu |