void prep(char grid[][]){
        int n = grid.length;
        int m = grid[0].length;
        foldedOrWhite = new int[n][m];
        foldedOrBlack = new int[n][m];
        for(int i=0; i<n; i++){
            for(int j=0; j<m; j++){
                if(black(grid, i, j)) foldedOrWhite[i][j] = 0; else foldedOrWhite[i][j] = j>0?foldedOrWhite[i][j-1]+1:1;
            }
        }
        for(int i=0; i<n; i++){
            for(int j=0; j<m; j++){
                if(white(grid, i, j)) foldedOrBlack[i][j] = 0; else foldedOrBlack[i][j] = j>0?foldedOrBlack[i][j-1]+1:1;
            }
        }
    }