!752 /*static class Bracket { int iOp, iCl; // indices of opening and closing bracket }*/ p { L tok = javaTok(loadSnippet("#1002114")); new L stack; new L> parts; boolean match = true; for (int i = 1; i < l(tok); i+= 2) { if (litlist("{", "(").contains(tok.get(i))) stack.add(i); else if (litlist("}", ")").contains(tok.get(i))) { if (empty(stack)) match = false; else parts.add(tok.subList(liftLast(stack), i+2)); } } if (!empty(stack)) match = false; print(match ? "Brackets match." : "Brackets do not match."); for (L part : parts) print(quote(join(part))); }