Where does it start going wrong?
Can you give some example input and what the program does when you enter that data?