GRIDCONN - Can KMP(Knutt-Morris-Pratt) algorithm be used?

GRIDCONN Problem - CodeChef. Since this problem involves finding the match of a substring S in a infinite string D can the KMP algortihm be used here?

No, the minimal position of S in D can be too big to do with KMP.