Given a string text, you want to use its characters to form as many copies of the word "balloon" as possible. Each character of text can be used at most once. Return the maximum number of copies that can be formed.
Given a string text, you want to use its characters to form as many copies of the word "balloon" as possible. Each character of text can be used at most once. Return the maximum number of copies that can be formed.
Example 1:
Input: {"text":"nlaebolko"}
Output: 1
Constraints:
1≤text.length≤104
text consists of lowercase English letters only.
Test Cases
Input (Stdin)
Expected Output (Stdout)
Execution Result
Run code to see results.
Input
arr ={"text":"nlaebolko"}
Count every letter of the 9-character text. Only b, a, l, o and n matter for "balloon".
text (0 / 9 tallied)
n
l
a
e
b
o
l
k
o
letters outside "balloon" seen so far: 0
bins: count, need per word, words this letter allows