-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathA 78 - Haiku.java
More file actions
34 lines (30 loc) · 963 Bytes
/
Copy pathA 78 - Haiku.java
File metadata and controls
34 lines (30 loc) · 963 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
33
34
import java.util.Scanner;
public class Haiku {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
String x;
int count;
boolean isTrue = true;
for (int i = 0; i < 3; i++) {
x = input.nextLine().toLowerCase();
count = 0;
for (int j = 0; j < x.length(); j++) {
if (x.charAt(j) == 'a' || x.charAt(j) == 'i' || x.charAt(j) == 'u' || x.charAt(j) == 'e' || x.charAt(j) == 'o') {
count++;
}
}
if (i == 0 && count != 5 || i == 2 && count != 5) {
isTrue = false;
} else if (i == 1 && count != 7) {
isTrue = false;
}
if (isTrue == false) {
System.out.println("NO");
break;
}
}
if (isTrue == true) {
System.out.println("YES");
}
}
}