I don't know why I am getting wrong answers every time I am submitting my solution. I'm a novice programmer. Please, help

I was trying this problem called SPELLBOB.
Here’s the link to my solution:
My solution
I have tried with multiple test cases and all the outputs match. But, the solution is somehow incorrect.
Please, help me understand where I’m going wrong.