void dfs(char[][] grid, int[][] visited, int i, int j, int n, int m) {
		if (visited[i][j] == 1)
			return;
		if (grid[i][j] == '1') {
			visited[i][j] = 1;
			if (i > 0)
				dfs(grid, visited, i - 1, j, n, m);
			if (i < n - 1)
				dfs(grid, visited, i + 1, j, n, m);
			if (j > 0)
				dfs(grid, visited, i, j - 1, n, m);
			if (j < m - 1)
				dfs(grid, visited, i, j + 1, n, m);
		}
	}