diff --git a/tasks/dyck/Dyck.java b/tasks/dyck/Dyck.java index 94ac702..0368f70 100644 --- a/tasks/dyck/Dyck.java +++ b/tasks/dyck/Dyck.java @@ -354,12 +354,17 @@ private static void outputFail(String testName, String message) { public static void main(String[] args) { Scanner sc = new Scanner(System.in); - int testcases = sc.nextInt(); - for (int t = 0; t < testcases; ++t) { - int n = sc.nextInt(); - ArrayList list = new ArrayList<>(); - for (int i = 0; i < n; ++i) list.add(sc.next().charAt(0)); - System.out.println(new Dyck().checkParentheses(list)); - } + + if (sc.hasNextInt()) { + int testcases = sc.nextInt(); + for (int t = 0; t < testcases; ++t) { + int n = sc.nextInt(); + ArrayList list = new ArrayList<>(); + for (int i = 0; i < n; ++i) list.add(sc.next().charAt(0)); + System.out.println(new Dyck().checkParentheses(list)); + } + } else { + new Dyck().testAll(); + } } }