-
Notifications
You must be signed in to change notification settings - Fork 0
/
peasoup.java
30 lines (28 loc) · 984 Bytes
/
peasoup.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
public class Peasoup {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int numOfRes = Integer.parseInt(sc.nextLine());
while(numOfRes > 0) {
int noOfMenuItems = Integer.parseInt(sc.nextLine());
boolean pancake = false;
boolean peasoup = false;
String resName = sc.nextLine();
for(int i = noOfMenuItems; i > 0; i--) {
String dish = sc.nextLine();
if (dish.equals("pancakes")) {
pancake = true;
} else {
if (dish.equals("pea soup")) {
peasoup = true;
}
}
}
if(pancake && peasoup) {
System.out.println(resName);
return;
}
numOfRes--;
}
System.out.println("Anywhere is fine I guess");
}
}