public static int getColInRowWithCollision(char[][] array, String word, int r) {
        // start from all possible places
        for(int i=0;i<array[0].length-word.length();i++) {
            int arrayPointer = i;
            int wordPointer = 0;
            while(wordPointer < word.length() && arrayPointer < array[0].length) {
                if(array[r][arrayPointer] == 0 || 
                        array[r][arrayPointer] == word.charAt(wordPointer)) {
                    wordPointer++;
                    if(wordPointer==word.length()) {
                        return arrayPointer - word.length() + 1;
                    }
                } else {
                    wordPointer = 0;
                }
                arrayPointer++;
            }
        }
        return -1;
    }