class Test{
public static void main(String[] args) {
String line = "ALONE AMEND DATES DAWNS DEALS LEMON LENDS";
int maxVowelAtChar = 4;
// need the help for this function.
String pure = myFunc(line, maxVowelChar);
System.out.println(pure);
}
}
Now it should print :
DAWNS LENDS
After maxVowelAtChar there should not be any vowel. the count start from last character of word. “ALONE” does not qualify since it has vowel at char 1 & 3, similarly “LEMON” has vowel at char 2. “DAWNS” qualifies since it has no vowels upto 3rd characters(4th one is A). Help me please.
EDITED: This code passes the clarified requirements. Changed to count from end backwards.
Before you criticise, see notes below.
This code has been simplified to illustrate the core of the solution. “Real” code would use a StringBuffer instead of
String += String.What makes this work is the dynamic regex passed to
matchesthat means “must end with n non-vowels”