# 遍历text,看字母balon各有几个,将 l o 的个数除以2#最后返回个数最少的值# 要判断一下cht的长度(如果不判断text = '12lloo' 将返回1)classSolution:defmaxNumberOfBalloons(self, text:str)->int:
cht = Counter(ch for ch in text if ch in'balon')
cht['l']//=2
cht['o']//=2return(min(cht.values())iflen(cht)==5else0)