Rat in a maze (implementation)

code link:- https://ide.geeksforgeeks.org/PLF8YvtuuS
does not give correct input output

@adityasharma07669 your code has many small mistakes i have corrected it look at this code https://ide.codingblocks.com/s/234611

it still does not give correct output. pls check again with this input

i/p:-
5 4
OXOO
OOOX
OOXO
XOOO
XXOO

check carefully the code i have sent you above is giving correct answer.