Quote:
I am deleting this question since no help is allowed on homework
No, help is allowed on homework, simply help is not us doing your homework.
Here, we help you fix your code, mainly, you have to show your code and explain what is wrong. A sample input, actual output and expected output will help too.
The better the description of problem, the better the help you get.