title: Change Bits Can Made One Flip
signature: change_bits_can_made_one_flip <- function(str) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      toString(actual)==toString(expected)
  }
  
  driver <- function(str, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(str), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          "00001", 
          TRUE
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          "0000", 
          FALSE
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          "11", 
          FALSE
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          "111110", 
          TRUE
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          "1", 
          TRUE
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          "111010111010", 
          FALSE
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          "hUInqJXNdbfP", 
          FALSE
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          "5191", 
          FALSE
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          "1110101101", 
          FALSE
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          "NupSrU xz", 
          FALSE
      )))
  
  }
  
  main()
source_py: def change_bits_can_made_one_flip(str):
      zeros = 0
      ones = 0
      for i in range(0, len(str)):
          ch = str[i]
          if (ch == '0'):
              zeros = (zeros + 1)
          else:
              ones = (ones + 1)
      return ((zeros == 1) or (ones == 1))
source_cpp: bool change_bits_can_made_one_flip(string str) {
    int zeros = 0, ones = 0;
    for ( char ch : str ) ( ch == '0' ) ? ++ zeros : ++ ones;
    return ( zeros == 1 || ones == 1 );
  }