import java.io.*; import java.util.*; public class CharStack { private char[] S; int top, size; public CharStack(int size){ S = new char[size]; top = -1; this.size = size; } public CharStack(){ this(100); } public boolean isEmpty(){return top == -1;} public boolean isFull(){return top == size-1;} public void push(char ch){ if (isFull()) throw new CharStackException("stack overflow"); top++; S[top] = ch;} public char pop() throws CharStackException { if (isEmpty()) throw new CharStackException("stack underflow"); char ch = S[top]; top--; return ch; } public String toString(){ String s = "["; if (top >= 0) s = s + S[0]; for (int i=1;i<=top;i++) s = s +","+ S[i]; return s + "]"; } public static void main(String[] args) throws IOException { Scanner sc = new Scanner(new File(args[0])); CharStack S = new CharStack(); String s = ""; char c = ';'; boolean valid = true; while (sc.hasNext() && valid){ s = sc.next(); for (int i=0;i