-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathP918B.java
40 lines (26 loc) · 1.1 KB
/
P918B.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
36
37
38
39
40
import java.util.Arrays;
import java.util.Scanner;
public class P918B {
public static void main (String[] args) {
Scanner entrada = new Scanner(System.in);
int n= entrada.nextInt(), m=entrada.nextInt();
String []servers_ip=new String[n], commands_ip= new String[m];
String []servers_names= new String[n], commands_names=new String[m];
for (int i = 0; i < n; i++) {
servers_names[i]= entrada.next();
servers_ip[i]= entrada.next();
}
for (int i = 0; i < m; i++) {
commands_names[i]= entrada.next();
commands_ip[i]= entrada.next();
commands_ip[i]=commands_ip[i].substring(0, commands_ip[i].length()-1);
}
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
if(commands_ip[i].equals(servers_ip[j])){
System.out.println(commands_names[i]+" "+commands_ip[i]+"; #"+servers_names[j]);
}
}
}
}
}