input: 
  def min_balanced_parts(s: str) -> int:
      """
      For a given string s, determine the smallest number of balanced substrings it can be divided into. A balanced substring is defined as one where each character occurs an equal number of times. For instance, with s = "ababcc", acceptable partitions include ("abab", "c", "c"), ("ab", "abc", "c"), and ("ababcc"), whereas ("a", "bab", "cc"), ("aba", "bc", "c"), and ("ab", "abcc") are incorrect since they are unbalanced.
  
      Output the least number of such substrings for the string s.
  
      Example cases:
      >>> s = "fabccddg"
      3
      >>> s = "abababaccddb"
      2
  
      Conditions:
      1 <= s.length <= 1000
      s is comprised of English lowercase letters only.
      """
  
output:     from collections import Counter
  
      def is_balanced(subs, counter):
          freq = counter[subs[0]]
          for char in subs:
              if counter[char] != freq:
                  return False
          return True
  
      count = 0
      while s:
          for i in range(1, len(s) + 1):
              counter = Counter(s[:i])
              if is_balanced(s[:i], counter):
                  count += 1
                  s = s[i:]
                  break
  
      return count