public boolean exist(char[][] board, String word) {
		// Start typing your Java solution below
		// DO NOT write main() function
		int m, n;
		if (board == null || (m = board.length) == 0
				|| (n = board[0].length) == 0)
			return false;
		boolean[][] flag = new boolean[m][n];
		char x = word.charAt(0);
		for (int i = 0; i < m; i++) {
			for (int j = 0; j < n; j++) {
				if (x == board[i][j]) {
					flag[i][j] = true;
					if (isExist(board, flag, i, j, word.substring(1)))
						return true;
					flag[i][j] = false;
				}
			}
		}
		return false;
	}