Give us some test cases so we can understand what is happening. Tell us example inputs, what your program outputs, and what it should be outputting. That will help everyone narrow down the problem.