-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathURI1218GetlineThreeShoes.java
More file actions
58 lines (51 loc) · 1.18 KB
/
URI1218GetlineThreeShoes.java
File metadata and controls
58 lines (51 loc) · 1.18 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
/**
* See
* <a href="https://www.urionlinejudge.com.br/judge/en/problems/view/1218">Getline
* Three - Shoes</a>
*
* @author Brian Yeicol Restrepo Tangarife
*/
public class URI1218GetlineThreeShoes {
static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
static PrintWriter out = new PrintWriter(System.out);
public static void main(String[] args) throws IOException {
int cases = 1, F, M, i;
String N, shoe, gender;
String[] shoes;
while ((N = read()) != null) {
shoes = read().split("\\s");
i = 0;
F = 0;
M = 0;
while (i < shoes.length) {
shoe = shoes[i++];
gender = shoes[i++];
if (N.equals(shoe)) {
switch (gender) {
case "F":
F++;
break;
case "M":
M++;
break;
}
}
}
if (cases != 1) {
out.println();
}
out.printf("Caso %d:\n", cases++);
out.println("Pares Iguais: " + (F + M));
out.println("F: " + F);
out.println("M: " + M);
}
out.close();
}
private static String read() throws IOException {
return in.readLine();
}
}