public int numMoves(String[] board) {
		m = board.length;
		n = board[0].length();
		char[][] map = new char[m][n];
		
		for(int i = 0;i < m;i++)
			map[i] = board[i].toCharArray();
		int answer = 0;
		for(int i = 0;i < m;i++){
			for(int j = 0;j < n;j++){
				//up
				if(ValidPosition(i-1, j)){
					swap(map, i, j, i-1, j);
					if(check(map, i-1, j) || check(map, i, j))
						answer++;
					swap(map, i, j, i-1, j);
				}
				//right
				if(ValidPosition(i, j+1)){
					swap(map, i, j, i, j+1);
					if(check(map, i, j) || check(map, i, j+1))
						answer++;
					swap(map, i, j, i, j+1);
				}
			}
		}
		
		return answer;
	}