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_1 , var_2 = len ( var_0 ) , len ( var_0 [ 0 ] )
      var_5 = [ var_3 for var_4 in range ( var_1 + var_2 ) for var_3 in ( ( 0 , var_4 ) , ( var_1 - 1 , var_4 ) , ( var_4 , 0 ) , ( var_4 , var_2 - 1 ) ) ]
      while var_5 :
          var_6 , var_7 = var_5.pop ( )
          if 0 <= var_6 < var_1 and 0 <= var_7 < var_2 and var_0 [ var_6 ] [ var_7 ] == 'O' :
              var_0 [ var_6 ] [ var_7 ] = 'S'
              var_5 += ( var_6 , var_7 - 1 ) , ( var_6 , var_7 + 1 ) , ( var_6 - 1 , var_7 ) , ( var_6 + 1 , var_7 )
      var_0 [ : ] = [ [ 'XO' [ var_8 == 'S' ] for var_8 in var_9 ] for var_9 in var_0 ]
  