Replace Each Consonant
Problem statement
Replace every consonant letter in text with the next consonant in bcdfghjklmnpqrstvwxyz. Preserve case, wrap z to b, and leave vowels and nonletters unchanged.
Function
replaceConsonants(text: String) → StringExamples
Example 1
text = "Code Z!"return = "Dofe B!"C becomes D, d becomes f, and Z wraps to B; vowels and punctuation remain.
Example 2
text = "aeiou"return = "aeiou"Vowels are unchanged.
Constraints
0 <= text.length <= 100000