You are viewing a single comment's thread. Return to all comments →
import java.util.*; 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()); final Pattern pattern = Pattern.compile("<(.+)>([^<>]+)</\\1>"); while (testCases > 0) { String line = in.nextLine(); Matcher matcher = pattern.matcher(line); if (!matcher.find()) { System.out.println("None"); } else { System.out.println(matcher.group(2)); while (matcher.find()) { System.out.println(matcher.group(2)); } } testCases--; } } }
Seems like cookies are disabled on this browser, please enable them to open this website
Tag Content Extractor
You are viewing a single comment's thread. Return to all comments →