Help me in solving EZSPEAK problem

My issue

My code

/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
	    Scanner input = new Scanner(System.in);
        int t = input.nextInt();
        input.nextLine(); // Consume the newline character after reading the integer

        for (int i = 1; i <= t; i++) {
            int size = input.nextInt();
            input.nextLine(); // Consume the newline character after reading the integer
            String word = input.nextLine();
            word = word.toLowerCase();
            
            String result = "";
            int count=0;
            
            for(int j=word.length()-1; j>=0; j--) {
                if(word.charAt(j) !='a' && word.charAt(j) !='e' && word.charAt(j) !='i' && word.charAt(j) !='o' && word.charAt(j)!='u') {
                    count++;
                }
            }
            
            if(count>=4) {
                System.out.println("NO");
            }
            else {
                System.out.println("YES");
            }

        }
	}
}

Problem Link: EZSPEAK Problem - CodeChef

@shanto_32 hey this is my code for this problem…

import java.util.;
import java.lang.
;
import java.io.*;

/* Name of the class has to be “Main” only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t–>0){
int n = sc.nextInt();
String s = sc.next();
s.toLowerCase();
if(s.length() < 4)
{System.out.println(“YES”);}

       else{
           int count=0;
          for(int i=0 ; i<n ; i++){
              if(count==4)
                { break;}
              if(s.charAt(i)=='a' || s.charAt(i)=='e' || s.charAt(i)=='i' || s.charAt(i)=='o' || s.charAt(i)=='u'){
                  count=0;
              }
              else{
                  count++;
              }
          }
       if(count==4)
         System.out.println("no");
       else 
         System.out.println("yes");
       } 
      }
}

}