/* stack cell class */ class scell { public final char symbol; public final int position; public final scell tail; public scell(char s, int p, scell t) { symbol=s; position=p; tail=t; } } // scell class sstack { private scell tos = null; // top of stack public void push(char s, int p) { tos = new scell(s,p,tos); } // the following function tries to delete the top cell from the stack // it returns true if successful, and false if stack was null public boolean pop() { if (tos == null) return false; tos = tos.tail; return true; } // the following function returns the cell at the top of the stack public scell peek() { return tos; } public boolean isempty() { return tos==null; } } // sstack public class delimiters { public static boolean leftd(char c) { return (c=='(' || c=='[' || c== '{'); } public static boolean rightd(char c) { return (c==')' || c==']' || c== '}'); } public static char leftcomp(char c) { switch (c) { case ')' : return '('; case ']' : return '['; case '}' : return '{'; default : return c; } } public static void check(String s) { int i = 0; int n = s.length(); char c; sstack stack = new sstack(); boolean halt = false; while (i