-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChef_and_Happy_String.java
More file actions
32 lines (31 loc) · 954 Bytes
/
Chef_and_Happy_String.java
File metadata and controls
32 lines (31 loc) · 954 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import java.util.Scanner;
import java.util.*;
import java.lang.*;
import java.io.*;
public class Chef_and_Happy_String {
public static void main(String[] args) throws java.lang.Exception {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
sc.nextLine();
while(t-->0){
String str = sc.next();
int count = 0;
for(int i = 0; i<str.length(); i++){
if(str.charAt(i) == 'a' || str.charAt(i) == 'e'
|| str.charAt(i) == 'o' || str.charAt(i) == 'u'
|| str.charAt(i) == 'i') {
count++;
if (count == 3) {
break;
}
}else {
count = 0;
}
}
if(count>2){
System.out.println("Happy");
}
else System.out.println("Sad");
}
}
}