in reply to Nested foreach loops

I am not going to submit what I have done so far as I do not want to embarass myself :P
Take a chance... show the code you have tried. I bet you will learn more from a critique of your code than if someone provides a complete solution.

If you have never seen nested foreach loops, the docs show an example: Foreach Loops