All the letters of the English alphabet are divided into vowels and consonants.
The vowels are: a, e, i, o, u, y.
The remaining letters are consonants.
A word is considered euphonious (pleasant-sounding) if it doesn't have three or more vowels or consonants in a row. Otherwise, it is considered discordant (harsh-sounding).
Your task is to create euphonious words from discordant. You can insert any letters inside the word. You should output the minimum number of characters needed to create a euphonious word from a given word.
For example, the word "schedule" is considered discordant because it has three consonants "sch" in a row. To create a euphonious word you need to add any vowel between 's' and 'c' or between 'c' and 'h'.
Processing strings
Create an euphonious word
Report a typo
Sample Input 1:
scheduleSample Output 1:
1Sample Input 2:
garageSample Output 2:
0Sample Input 3:
playerSample Output 3:
1Sample Input 4:
biiiiigSample Output 4:
2Write a program in Java 17
import java.util.*;
public class Main {
public static void main(String[] args) {
// write your code here
}
}
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.