-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
27 lines (24 loc) · 830 Bytes
/
Main.java
File metadata and controls
27 lines (24 loc) · 830 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
27
package algorithm.huawei;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
String tag = in.nextLine();
String data = in.nextLine();
String[] split = data.split("\\s+");
for (int i = 0; i < split.length; ) {
int length = Integer.parseInt(split[i + 2] + split[i + 1], 16);
if (tag.equals(split[i])) {
StringBuilder builder = new StringBuilder();
for (int j = i + 3; j < i + 3 + length; j++) {
builder.append(split[j]).append(" ");
}
System.out.println(builder.toString());
break;
} else {
i += length + 3;
}
}
in.close();
}
}