Implement the Minesweeper game.
Given a 2D board and a clicked cell [row, col], return the updated board. M is an unrevealed mine, E is unrevealed empty space, B is revealed space with no adjacent mine, and digits show adjacent mine counts. If the click is a mine, change it to X. Otherwise, mark the clicked cell B, then reveal neighboring E cells: assign a digit when adjacent mines exist, or assign B and continue expanding when none exist. Existing revealed cells remain unchanged.
Signature: def update_board(board, click):
Examples: board=[['E','E'],['E','M']], click=[0,0] returns [['B','1'],['1','M']]. An empty board clicked at [0,0] reveals its connected region as B cells.
Constraints: the board is rectangular, non-empty, the click is valid, and there are at most 10,000 cells.
def update_board(board, click):