Count the number of vowels in the given string by using queue
import java.util.*;
class Count
{
public static void main(String args[])
{
String input=”queue”;//4
Queue<Character> q=new LinkedList<>();
int count=0;
for(char ch:input.toCharArray())//e
{
q.add(ch);//e
}
while(!q.isEmpty())//true
{
char ch=q.remove();
if(“aeiouAEIOU”.indexOf(ch)!=-1)//indexof returns -1 if value is not found
{
count++;
}
}
System.out.println(count);
}}