import java.io.*; import java.util.*; public class format { public static void main(String[] args) throws Exception{ BufferedReader reader = new BufferedReader(new FileReader("format.in")); int sets = Integer.parseInt(reader.readLine()); for(int i = 1; i <= sets; i++){ String one = reader.readLine(); String two = reader.readLine(); System.out.print("Data Set "+1+": "); String newone = reformat(one); String newtwo = reformat(two); //System.out.println(newone); //System.out.println(newtwo); if(newone.equalsIgnoreCase(newtwo)){ System.out.println("equal"); }else System.out.println("not equal"); if(i!=sets) System.out.println(); } } public static String reformat(String s){ String t = s.replaceAll("[ \t]+"," "); t = t.replaceAll("\\{", "\\("); t = t.replaceAll("\\[", "\\("); t = t.replaceAll("\\}", "\\)"); t = t.replaceAll("\\]", "\\)"); t = t.replaceAll("[ ]?\\)[ ]?", "\\)"); t = t.replaceAll("[ ]?\\([ ]?", "\\("); t = t.replaceAll("[ ]?;[ ]?", ","); t = t.replaceAll("[ ]?,[ ]?",","); t = t.replaceAll("[ ]?\\.[ ]?","\\."); t = t.replaceAll("[ ]?:[ ]?",":"); return t.trim(); } }