Open Amisha328 opened 2 years ago
Maybe it is about time complexity or space complexity. even if I trim the string, test cases not passed. Here is another approach from me -> s = s.replaceAll("[\d\s\p{Punct}]",""); vowel = s1.replaceAll("(?i)[^aeiou]","").length(); conso = s1.replaceAll("(?i)[aeiou]","").length();
if you already figured out, please tell me.
In the main method, read a String (which may have alphabets along with numeric digits) and print the number of vowels and consonants (any alphabet apart from vowel is a consonant) present in the given String. Note: The output should be printed in the same format as mentioned in the sample output. Number of Vowels: n Number of Consonants: m
Find Code here
Suggest some test case(s) for which this code will give wrong answers. Any suggestions for improvement of the code will be acknowledged.