-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBar
More file actions
26 lines (22 loc) · 773 Bytes
/
Bar
File metadata and controls
26 lines (22 loc) · 773 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
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
Set<String> alcohol = new HashSet<>(Arrays.asList(
"ABSINTH", "BEER", "BRANDY", "CHAMPAGNE", "GIN",
"RUM", "SAKE", "TEQUILA", "VODKA", "WHISKEY", "WINE"
));
int n = Integer.parseInt(sc.nextLine().trim());
int cnt = 0;
for (int i = 0; i < n; i++) {
String s = sc.nextLine().trim();
if (Character.isDigit(s.charAt(0))) {
if (Integer.parseInt(s) < 18) cnt++;
} else if (alcohol.contains(s)) {
cnt++;
}
}
System.out.println(cnt);
sc.close();
}
}