finding given string in a matrix. character cannot be repeated while traversing