I am stuck, because when I test on my IDE, I get the proper output. Is there an edge case I need to account for?
package com.codegym.task.task19.task1918;
/*
Introducing tags
*/
import java.io.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Solution {
public static void main(String[] args) throws IOException {
StringBuilder sb = new StringBuilder();
try (BufferedReader buff = new BufferedReader(new InputStreamReader(System.in));
BufferedReader input = new BufferedReader(new FileReader(buff.readLine()))) {
while (input.ready()) sb.append(input.readLine());
}
Pattern pattern = Pattern.compile("<" + args[0] + ".*?>.*<\\/" + args[0] + ">", Pattern.MULTILINE);
Matcher m = pattern.matcher(sb.toString().replaceAll("\n", ""));
while (m.find()) System.out.println(m.group());
}
}