Suggestion

It worked as expected. The output looks a bit weird though. I would suggest that you add a blank line at the end of it.

Maybe add:

print ”
“;

to line 103 and 140?

Thanks!