My issue
Sub-Task Task # Result
(time)
1 1 Correct
(0.12)
1 2 Run Time Error
(0.14)
1 3 Skipped Testfile
Subtask Score: 0% Result - Run Time Error
Total Score = 0%
this message is displayed. the code appears to be correct but gives this error message
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 read = new Scanner(System.in);
int t = read.nextInt();
for(int i = 0 ; i<t ;i++){
String str = read.next();
int j = 0 ;
int l = 0 ;
int count = 0;
while(l<str.length()){
int temp = 0 ;
while(str.charAt(l) == 'a'||str.charAt(l) == 'e'||str.charAt(l) == 'i'||str.charAt(l) == 'o'||str.charAt(l) == 'u'){
temp = temp + 1;
l++;
if(l==str.length()-1){
break;
}
}
if(count<temp){
count= temp;
}
l=l+1;
}
if(count>2){
System.out.println("Happy");
}else{
System.out.println("Sad");
}
}
}
}
Learning course: Strings using Java
Problem Link: CodeChef: Practical coding for everyone