I think it's pretty messy, but it shows the correct output. Why does it fail the task?