You are viewing a single comment's thread. Return to all comments →
Can be solved in one line:
String input=sc.next(); while(input.length() != (input = input.replaceAll("\\(\\)|\\[\\]|\\{\\}", "")).length()); System.out.println(input.isEmpty());
But no stack used for this :)
Java Stack
You are viewing a single comment's thread. Return to all comments →
Can be solved in one line:
But no stack used for this :)