comefrom: <awangdev>361. Bomb Enemy_1.java
code: public int maxKilledEnemies(char[][] grid) {
          if (grid == null || grid.length == 0 || grid[0].length == 0) {
              return 0;
          }
          int m = grid.length;
          int n = grid[0].length;
          int[][] up = new int[m][n];
          int[][] down = new int[m][n];
          int[][] left = new int[m][n];
          int[][] right = new int[m][n];
          
          for (int i = 0; i < m; i++) {
              for (int j = 0; j < n; j++) {
                  if (grid[i][j] != 'W') {
                      up[i][j] = grid[i][j] == 'E' ? 1 : 0;
                      up[i][j] += i - 1 >= 0 ? up[i - 1][j] : 0;
                  }
              }
          }
  
          for (int i = m - 1; i >= 0; i--) {
              for (int j = 0; j < n; j++) {
                  if (grid[i][j] != 'W') {
                      down[i][j] = grid[i][j] == 'E' ? 1 : 0;
                      down[i][j] += i + 1 < m ? down[i + 1][j] : 0;                    
                  }
              }
          }
          
          for (int i = 0; i < m; i++) {
              for (int j = 0; j < n; j++) {
                  if (grid[i][j] != 'W') {
                      left[i][j] = grid[i][j] == 'E' ? 1 : 0;
                      left[i][j] += j - 1 >= 0 ? left[i][j - 1] : 0;
                  }
              }
          }
  
          for (int i = 0; i < m; i++) {
              for (int j = n - 1; j >= 0; j--) {
                  if (grid[i][j] != 'W') {
                      right[i][j] = grid[i][j] == 'E' ? 1 : 0;
                      right[i][j] += j + 1 < n ? right[i][j + 1] : 0;
                  }
              }
          }
          
          
          int max = 0;
          for (int i = 0; i < m; i++) {
              for (int j = 0; j < n; j++) {
                  if (grid[i][j] == '0') {
                      max = Math.max(max, up[i][j] + down[i][j] + left[i][j] + right[i][j]);
                  }
              }   
          }
          return max;
      }
masked: public int sample_funcname ( char [ ] [ ] var_0 ) {
    if ( var_0 == null || var_0 . length == 0 || var_0 [ 0 ] . length == 0 ) {
      return 0 ;
    }
    int var_1 = var_0 . length ;
    int var_2 = var_0 [ 0 ] . length ;
    int [ ] [ ] var_3 = new int [ var_1 ] [ var_2 ] ;
    int [ ] [ ] var_4 = new int [ var_1 ] [ var_2 ] ;
    int [ ] [ ] var_5 = new int [ var_1 ] [ var_2 ] ;
    int [ ] [ ] var_6 = new int [ var_1 ] [ var_2 ] ;
    for ( int var_7 = 0 ;
    var_7 < var_1 ;
    var_7 ++ ) {
      for ( int var_8 = 0 ;
      var_8 < var_2 ;
      var_8 ++ ) {
        if ( var_0 [ var_7 ] [ var_8 ] != 'W' ) {
          var_3 [ var_7 ] [ var_8 ] = var_0 [ var_7 ] [ var_8 ] == 'E' ? 1 : 0 ;
          var_3 [ var_7 ] [ var_8 ] += var_7 - 1 >= 0 ? var_3 [ var_7 - 1 ] [ var_8 ] : 0 ;
        }
      }
    }
    for ( int var_7 = var_1 - 1 ;
    var_7 >= 0 ;
    var_7 -- ) {
      for ( int var_8 = 0 ;
      var_8 < var_2 ;
      var_8 ++ ) {
        if ( var_0 [ var_7 ] [ var_8 ] != 'W' ) {
          var_4 [ var_7 ] [ var_8 ] = var_0 [ var_7 ] [ var_8 ] == 'E' ? 1 : 0 ;
          var_4 [ var_7 ] [ var_8 ] += var_7 + 1 < var_1 ? var_4 [ var_7 + 1 ] [ var_8 ] : 0 ;
        }
      }
    }
    for ( int var_7 = 0 ;
    var_7 < var_1 ;
    var_7 ++ ) {
      for ( int var_8 = 0 ;
      var_8 < var_2 ;
      var_8 ++ ) {
        if ( var_0 [ var_7 ] [ var_8 ] != 'W' ) {
          var_5 [ var_7 ] [ var_8 ] = var_0 [ var_7 ] [ var_8 ] == 'E' ? 1 : 0 ;
          var_5 [ var_7 ] [ var_8 ] += var_8 - 1 >= 0 ? var_5 [ var_7 ] [ var_8 - 1 ] : 0 ;
        }
      }
    }
    for ( int var_7 = 0 ;
    var_7 < var_1 ;
    var_7 ++ ) {
      for ( int var_8 = var_2 - 1 ;
      var_8 >= 0 ;
      var_8 -- ) {
        if ( var_0 [ var_7 ] [ var_8 ] != 'W' ) {
          var_6 [ var_7 ] [ var_8 ] = var_0 [ var_7 ] [ var_8 ] == 'E' ? 1 : 0 ;
          var_6 [ var_7 ] [ var_8 ] += var_8 + 1 < var_2 ? var_6 [ var_7 ] [ var_8 + 1 ] : 0 ;
        }
      }
    }
    int max = 0 ;
    for ( int var_7 = 0 ;
    var_7 < var_1 ;
    var_7 ++ ) {
      for ( int var_8 = 0 ;
      var_8 < var_2 ;
      var_8 ++ ) {
        if ( var_0 [ var_7 ] [ var_8 ] == '0' ) {
          max = Math . max ( max , var_3 [ var_7 ] [ var_8 ] + var_4 [ var_7 ] [ var_8 ] + var_5 [ var_7 ] [ var_8 ] + var_6 [ var_7 ] [ var_8 ] ) ;
        }
      }
    }
    return max ;
  }
  