comefrom: <qiyuangong>130_Surrounded_Regions_2.py
code: def solve( board):
      if not any(board): return
      
      height, width = len(board), len(board[0])
      save = [ij for k in range(height + width) for ij in ((0, k), (height - 1, k), (k, 0), (k, width - 1))]
      while save:
          i, j = save.pop()
          if 0 <= i < height and 0 <= j < width and board[i][j] == 'O':
              board[i][j] = 'S'
              save += (i, j - 1), (i, j + 1), (i - 1, j), (i + 1, j)
      board[:] = [['XO'[c == 'S'] for c in row] for row in board]
masked: def sample_funcname ( var_0 ) :
      if not any ( var_0 ) : return
      var_3 , var_5 = len ( var_0 ) , len ( var_0 [ 0 ] )
      var_10 = [ var_6 for var_7 in range ( var_3 + var_5 ) for var_6 in ( ( 0 , var_7 ) , ( var_3 - 1 , var_7 ) , ( var_7 , 0 ) , ( var_7 , var_5 - 1 ) ) ]
      while var_10 :
          var_12 , var_13 = var_10.pop ( )
          if 0 <= var_12 < var_3 and 0 <= var_13 < var_5 and var_0 [ var_12 ] [ var_13 ] == 'O' :
              var_0 [ var_12 ] [ var_13 ] = 'S'
              var_10 += ( var_12 , var_13 - 1 ) , ( var_12 , var_13 + 1 ) , ( var_12 - 1 , var_13 ) , ( var_12 + 1 , var_13 )
      var_0 [ : ] = [ [ 'XO' [ var_17 == 'S' ] for var_17 in var_18 ] for var_18 in var_0 ]
  