comefrom: <doocs>2222.Number of Ways to Select Buildings_1.py
code: def numberOfWays( s: str) -> int:
      n = len(s)
      cnt0 = s.count("0")
      cnt1 = n - cnt0
      c0 = c1 = 0
      ans = 0
      for c in s:
          if c == "0":
              ans += c1 * (cnt1 - c1)
              c0 += 1
          else:
              ans += c0 * (cnt0 - c0)
              c1 += 1
      return ans
masked: def sample_funcname ( var_0 : str ) -> int :
      var_4 = len ( var_0 )
      var_7 = var_0.count ( "0" )
      var_8 = var_4 - var_7
      var_11 = var_9 = 0
      var_12 = 0
      for var_13 in var_0 :
          if var_13 == "0" :
              var_12 += var_9 * ( var_8 - var_9 )
              var_11 += 1
          else :
              var_12 += var_11 * ( var_7 - var_11 )
              var_9 += 1
      return var_12
  