Q: Delimiter Matching using Stack I have a small problem here you might consider answering;
Here is the code;
public void analyze (String input, int length, int j){
    if (j == length){
        return;
    }
    if(input.charAt(j) == '{' || input.charAt(j) == '(')
        push(input.charAt(j));
    else
        pop();
    j++;    

    analyze (input, length, j);
}

Output:
Original List: {()}



List: {

Well, the problem is the List should be empty but I couldn't seem to find the solution.
Thank you in advance.
Here is the full code:
http://pastebin.com/nXc79gHf

A: 
Assuming your input contain only '}', '{' and '(', ')' characters.

replace by below code (assuming push() and pop() do work fine)...
public void analyze(String input, int length, int j){
        if (j >= length) return;
        if(input.charAt(j) == '{' || input.charAt(j) == '(')
            push(input.charAt(j));
        else if(input.charAt(j) == '}' || input.charAt(j) == ')')
            pop();
        analyze (input, length, ++j);
    }

call by using analyze(input, input.length(), 0);
Ex. {()}
