Okay well, welcome to the forum.
When you put code into a post, please put three backticks (```) before the code block starts, and another three backticks after it ends, so it will render properly.
You’ve copied my solution without removing the extra loop that i pointed out in post 16. There should be no J loop.