-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTwentyNine.java
More file actions
38 lines (28 loc) · 826 Bytes
/
TwentyNine.java
File metadata and controls
38 lines (28 loc) · 826 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
28
29
30
31
32
33
package HackerRank;
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class TwentyNine {
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();
//Write your code here
boolean matchFound = false;
Pattern pattern = Pattern.compile("<(.+)>([^<]+)</\\1>");
Matcher match = pattern.matcher(line);
while(match.find()){
System.out.println(match.group(2));
matchFound = true;
}
if(!matchFound){
System.out.println("None");
}
testCases--;
}
in.close();
}
}