Given a string text, you want to use the characters of text to form as many instances of the word "balloon" as possible.
You can use each character in text at most once. Return the maximum number of instances that can be formed.
 
Example 1:

Input: text = "nlaebolko"
Output: 1

Example 2:

Input: text = "loonbalxballpoon"
Output: 2

Example 3:
Input: text = "leetcode"
Output: 0

 
Constraints:

1 <= text.length <= 10^4
text consists of lower case English letters only.

Difficulty: introductory

Starter code:

class Solution:
    def maxNumberOfBalloons(self, text: str) -> int:
        

Solutions:
class Solution:
    def maxNumberOfBalloons(self, text: str) -> int:
        memo = defaultdict(int)
        for t in text:
            if t in 'balon':
                memo[t] += 1
        count_once = min(memo['b'], memo['a'], memo['n'])
        count_twice = min(memo['l'], memo['o'])
        return min(count_once, count_twice // 2)

class Solution:
    def maxNumberOfBalloons(self, text: str) -> int:
        ret = []
        for i in 'ban':
            ret.append(text.count(i))
        for i in 'lo':
            ret.append(text.count(i) // 2)
        return min(ret)

class Solution:
    def maxNumberOfBalloons(self, text: str) -> int:
        d = {'b':0,'a':0,'l':0,'o':0,'n':0}
        for char in text:
            if char in d:
                d[char]+=1
        d['l']//=2
        d['o']//=2
        return min(d.values())
            
            
            
        


class Solution:
    def maxNumberOfBalloons(self, text: str) -> int:
        text = list(text)
        text2=['a', 'b', 'l', 'n', 'o']
        num1=[1,1,2,1,2]
        nums2=[]
        for j in range(len(text2)):
            k=len([number for number in text if number ==text2[j]])
            #print([number for number in text if number ==text2[j]])
            nums2.append(k)
        print(nums2)
        rt=[]
        for j in range(len(nums2)):
            rt.append(nums2[j]/num1[j])

        return int(min(rt))
        


from collections import Counter

class Solution:
    def maxNumberOfBalloons(self, text: str) -> int:
        word = 'balloon'
        arr = []
        dic = Counter(list(text))
        for c in word:
            arr.append(dic[c]//word.count(c))
        return min(arr)

class Solution:
    def maxNumberOfBalloons(self, text: str) -> int:
        count_balloon = 0
        
        count_b = 0
        count_a = 0
        count_l = 0
        count_o = 0
        count_n = 0
        
        for char in text: 
            if(char == 'b'):
                count_b += 1
            elif(char == 'a'):
                count_a += 1
            elif(char == 'l'):
                count_l += 1
            elif(char == 'o'):
                count_o += 1
            elif(char == 'n'):
                count_n += 1

        count_balloon =  min(count_b, count_a, count_l // 2, count_o // 2, count_n)
        return count_balloon
        


class Solution:
    def maxNumberOfBalloons(self, text: str) -> int:
        return min(text.count('b'),text.count('a'),text.count('l')//2,text.count('o')//2,text.count('n'))