-
Notifications
You must be signed in to change notification settings - Fork 2
/
Main.java
40 lines (38 loc) · 1.32 KB
/
Main.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
package L1_059;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/**
* @author zmj
* @create 2019/5/7
*/
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
for (int i = 0; i < n; i++) {
String[] line = br.readLine().split(", ");
String a = line[0];
String b = line[1];
int lena = a.length();
int lenb = b.length();
if (lena >= 3 && lenb >= 4) {
String suba = a.substring(lena - 3, lena);
String subb = b.substring(lenb - 4, lenb-1);
if (suba.equals("ong") && subb.equals("ong")) {
// 原样输出上联
System.out.print(a + ", ");
String[] res = b.split(" ");
for (int j = 0; j < res.length-3; j++) {
System.out.print(res[j] + " ");
}
System.out.println("qiao ben zhong.");
} else {
System.out.println("Skipped");
}
} else {
System.out.println("Skipped");
}
}
}
}