Rat in a maze : input error

How to take character input in a 2d array after an integer input.
I am facing errors like : NoSuchElementException.

Take input as array of string then access each character using are[i].charAt(j)

I am not able to get the write answer.

Please look into the code

Your code accesses out of bounds array indexes.