Skip to content

Commit 19bea3c

Browse files
authored
Java Strings!
1 parent 576e301 commit 19bea3c

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import java.io.*;
2+
import java.util.*;
3+
import java.text.*;
4+
import java.math.*;
5+
import java.util.regex.*;
6+
7+
public class Solution{
8+
public static void main(String[] args) {
9+
Scanner scan = new Scanner(System.in);
10+
int testCases = Integer.parseInt(scan.nextLine());
11+
while (testCases-- > 0) {
12+
String line = scan.nextLine();
13+
boolean matchFound = false;
14+
Pattern r = Pattern.compile("<(.+)>([^<]+)</\\1>");
15+
Matcher m = r.matcher(line);
16+
while (m.find()) {
17+
System.out.println(m.group(2));
18+
matchFound = true;
19+
}
20+
if (!matchFound) {
21+
System.out.println("None");
22+
}
23+
}
24+
scan.close();
25+
}
26+
}
27+
28+
29+

0 commit comments

Comments
 (0)