-
-
Notifications
You must be signed in to change notification settings - Fork 109
Expand file tree
/
Copy pathTagContentExtractor.java
More file actions
27 lines (25 loc) · 721 Bytes
/
Copy pathTagContentExtractor.java
File metadata and controls
27 lines (25 loc) · 721 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
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution{
public static void main(String[] args){
Scanner in = new Scanner(System.in);
int testCases = Integer.parseInt(in.nextLine());
while(testCases>0){
String line = in.nextLine();
int count=0;
Pattern r = Pattern.compile("<(.+?)>([^<>]+)</\\1>");
Matcher m = r.matcher(line);
while(m.find()) {
if (m.group(2).length() !=0) {
System.out.println(m.group(2));
count++;
}
}
if (count == 0) System.out.println("None");
testCases--;
}
}
}