package leetcode;

/**
 * https://leetcode.com/problems/maximum-number-of-balloons/
 */
public class Problem1189 {
    public int maxNumberOfBalloons(String text) {
        // TODO
        return 0;
    }

    public static void main(String[] args) {
        Problem1189 prob = new Problem1189();
        System.out.println(prob.maxNumberOfBalloons("nlaebolko")); // 1
        System.out.println(prob.maxNumberOfBalloons("loonbalxballpoon")); // 2
        System.out.println(prob.maxNumberOfBalloons("leetcode")); // 0
    }
}

@@ -170,282 +170,530 @@
     
-// TODO%0A        return 0;%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A        Problem1189 prob = new Problem1189();%0A        System.out.println(prob.maxNumberOfBalloons(%22nlaebolko%22)); // 1%0A        System.out.println(prob.maxNumberOfBalloons(%22loonbalxballpoon%22)); //
+int%5B%5D counts = new int%5B26%5D;%0A        for (char c : text.toCharArray()) %7B%0A            counts%5Bc - 'a'%5D++;%0A        %7D%0A        int answer = 0;%0A        boolean found = true;%0A        while (found) %7B%0A            if (counts%5B'b' - 'a'%5D %3E= 1 && counts%5B'a' - 'a'%5D %3E= 1 &&%0A                counts%5B'l' - 'a'%5D %3E= 2 && counts%5B'o' - 'a'%5D %3E= 2 &&%0A                counts%5B'n' - 'a'%5D %3E= 1) %7B%0A                counts%5B'b' - 'a'%5D--;%0A                counts%5B'a' - 'a'%5D--;%0A                counts%5B'l' - 'a'%5D -= 2;%0A                counts%5B'o' - 'a'%5D -=
  2
+;
 %0A   
@@ -701,70 +701,161 @@
     
-System.out.println(prob.maxNumberOfBalloons(%22leetcode%22)); // 0
+        counts%5B'n' - 'a'%5D--;%0A                answer++;%0A            %7D else %7B%0A                found = false;%0A            %7D%0A        %7D%0A        return answer;
 %0A   

Solve problem 1189