public boolean exist(char[][] board, String word) {
    	if (word == null) return false;
    	if ("".equals(word)) return true;
    	if (board.length ==0 ||board[0].length==0) return false;
    	boolean[][] visit = new boolean[board.length][];
    	for (int i = 0; i < board.length; i ++)
    	{
    		visit[i] =  new boolean[board[0].length];
    		for (int j =  0; j<visit[i].length; j++) visit[i][j] = false;
    	}
    	for (int i=0;i<board.length;i++)
    		for (int j = 0;j<board[0].length;j++)
    		{
    			if (search(i,j,word,0,board,visit)) return true;
    		}
        return false;
    }