-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSleuth.java
More file actions
34 lines (31 loc) · 704 Bytes
/
Sleuth.java
File metadata and controls
34 lines (31 loc) · 704 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.io.*;
import java.util.*;
public class Sleuth{
public static void main(String args[]){
int i,l;
String s;
char ch;
Scanner sc = new Scanner(System.in);
s = sc.nextLine();
s=s.toLowerCase();
ArrayList<String> list = new ArrayList<>();
String a[] = s.split(" ");
for(i=0;i<a.length;i++){
list.add(a[i]);
}
l = list.size()-1;
while(list.get(l).equals(" ")||list.get(l).equals("?")||list.get(l).equals("")){
l--;
}
String p = list.get(l);
ch = p.charAt(p.length()-1);
if(ch=='?'){
ch=p.charAt(p.length()-2);
}
if(ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u'||ch=='y'){
System.out.println("YES");
}else{
System.out.println("NO");
}
}
}