RUNTIME ERROR for UVA problem 10653

I am submitting my solution for this problem on the site but getting RUNTIME ERROR continuosly,
I am unable to find problem in my code now, please check my code

Thanks and regards

please check any one could help :frowning:

It seems that for input

.#...
.#.#.
...#.

it returns 9, but it is 10 isn’t it?

0#678
1#5#9
234#A