-
Notifications
You must be signed in to change notification settings - Fork 0
/
bombonfav.java
35 lines (30 loc) · 984 Bytes
/
bombonfav.java
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
35
import java.util.*;
public class bombonfav {
public static void main(String[] args) {
Scanner kbd = new Scanner(System.in);
int intput = kbd.nextInt();
kbd.nextLine();
boolean[] reses = new boolean[intput];
for(int i = 0; i < intput; i++) {
String input1= kbd.nextLine();
//kbd.nextLine();
String input2= kbd.nextLine();
//kbd.nextLine();
String[] splitted = input2.split(" ");
for(int j = 0; j < splitted.length; j++) {
if(splitted[j].equals(String.valueOf(input1.charAt(2)))) {
reses[i] = true;
break;
}
}
}
kbd.close();
for(int i = 0; i < intput; i++) {
if(reses[i]) {
System.out.println("YES");
} else {
System.out.println("NO");
}
}
}
}