this is kinda horrible. If you catch an Exception, you have to handle it. At least print the stacktrace. When getting exceptions, closing your eyes and pretending they don’t exist is not the solution!
I removed this since it is not helping.
while true
while(n>=1 || n<=100)
is the same as
while(true)
this is not what you want. You want to decrease n somewhere. Also, this should be t, not n
while(t-->0)
is what you want
unnecessary if statement
In the following I replace “count” with “n” to make it less confusing for myself.
if(n>=1 || n<=100){
...
}
that if statement is not needed since the input already constrains n to be between (inclusive) 1 and 100. So I remove it.
slightly wrong edge case
if(n<=4){
System.out.println("YES");
}
this should be n<4. Remember that if we have a word with exactly 4 consonants, we need to print “NO”