A position is an arrangement of pieces on the checkerboard at a particular time during the game. Given a position, you are to calculate the total number of possible moves that can be made on the next turn.
The game of checkers is played by two players on an 8x8 grid with alternating black and white squares (any two squares that share an edge have different colors). The leftmost square of the top row is always black, and the playable surface consists of only the 32 black squares. Each player starts with 12 pieces. The first player's pieces are black, and the second player's pieces are white. Black pieces start from the top part of the board and can only move toward the bottom, while white pieces start from the bottom and only move toward the top. The two players alternate moves.
There are two ways you can move a piece: slide it diagonally forward to an adjacent unoccupied black square, or "jump" an opponent's piece. You can jump an opponent's piece only if it is diagonally adjacent and there is a vacant square directly beyond it in the same direction. When you perform a jump, your piece will end up in that vacant square, and the opponent's piece will be removed from the board. Jumping is mandatory, so if there is an opportunity to make a jump, it must be taken. When multiple jumps are possible, any one of them can be chosen. As mentioned earlier, both slides and jumps can only be made in the "forward" direction, meaning that black pieces must move toward the bottom of the board and white pieces must move toward the top.
You will be given a String board that contains the current position of a checkers game. The j-th character of the i-th element represents the contents of the square at row i, column j (where row 0 is the topmost row, and column 0 is the leftmost column). A space (' ') represents a vacant square, and 'W' and 'B' represent squares occupied by white and black pieces, respectively. You are to determine the total number of possible moves in this position. You don't know which player has the next turn, so return the sum of all possible moves for both players.