# Give you a string text, You need to use text To piece together as many words as possible "balloon"( balloon ).
#
# character string text Each letter in can only be used once at most . Please return the maximum number of words you can piece together "balloon".
#
#
#
# Example 1:
#
#
#
# Input :text = "nlaebolko"
# Output :1
#
#
# Example 2:
#
#
#
# Input :text = "loonbalxballpoon"
# Output :2
#
#
# Example 3:
#
# Input :text = "leetcode"
# Output :0
#
#
#
#
# Tips :
#
#
# 1 <= text.length <= 10^4
# text All consist of lowercase English letters
#
# Related Topics Hashtable character string Count 68 0
# leetcode submit region begin(Prohibit modification and deletion)
class Solution:
def maxNumberOfBalloons(self, text: str) -> int:
cnt = Counter(text)
return min(cnt['b'], cnt['a'], cnt['l']//2, cnt['o']//2, cnt['n'])
# leetcode submit region end(Prohibit modification and deletion)
use counter Two lines .