When asking a question like this, it helps if you also provide (as well as the description you included and your code):
1. A sample input you have tried
2. The current output from your sample
3....