title: Ways Remove One Element Binary String Xor Becomes Zero
signature: def ways_remove_one_element_binary_string_xor_becomes_zero(str):
test_code: import array
  import bisect
  import collections
  import datetime
  import functools
  import heapq
  import itertools
  import math
  import queue
  import re
  import string
  import sys
  from typing import Any, Dict, List, Optional, Set
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  def validate_solution(actual, expected):
      return actual == expected
  
  def driver(str, expected):
      try:
          if validate_solution(PLACEHOLDER_FN_NAME(
              str),
              expected
          ):
              return "PASSED"
          return "FAILED"
      except Exception as exception_obj:
          return type(exception_obj).__name__
      
  if __name__ == "__main__":
      result = driver("KfcTJNP", 7)
      print(f"TEST-0...{result}")
  
      result = driver("05312505872", 1)
      print(f"TEST-1...{result}")
  
      result = driver("100111", 2)
      print(f"TEST-2...{result}")
  
      result = driver("tDEEhKxrQ", 9)
      print(f"TEST-3...{result}")
  
      result = driver("50824233019", 1)
      print(f"TEST-4...{result}")
  
      result = driver("10001110010", 5)
      print(f"TEST-5...{result}")
  
      result = driver("T SEZaNm MYQ", 12)
      print(f"TEST-6...{result}")
  
      result = driver("838415739", 1)
      print(f"TEST-7...{result}")
  
      result = driver("01110100", 4)
      print(f"TEST-8...{result}")
  
      result = driver("WYQiAey H", 9)
      print(f"TEST-9...{result}")
  
      sys.exit(0)
source_py: def ways_remove_one_element_binary_string_xor_becomes_zero(str):
      one_count = 0
      zero_count = 0
      n = len(str)
      for i in range(0, n, 1):
          if (str[i] == '1'):
              one_count += 1
          else:
              zero_count += 1
      if ((one_count % 2) == 0):
          return zero_count
      return one_count
source_cpp: int ways_remove_one_element_binary_string_xor_becomes_zero(string str) {
    int one_count = 0, zero_count = 0;
    int n = str . length ( );
    for ( int i = 0;
    i < n;
    i ++ ) if ( str [ i ] == '1' ) one_count ++;
    else zero_count ++;
    if ( one_count % 2 == 0 ) return zero_count;
    return one_count;
  }