Hello and welcome to the forum,
We will help you work on your code. We won't post solutions - when posted by other than the original requestor of a topic, they are deleted.
If you are having problems, you need to explain what the problem is and show the bit of code that you have so far.
What does the input look like - to get to the posted output?
Hope this helps,