package leetcode;

/**
 * https://leetcode.com/problems/count-the-number-of-consistent-strings/
 */
public class Problem1684 {
    public int countConsistentStrings(String allowed, String[] words) {
         // TODO
        return 0;
    }

    public static void main(String[] args) {
        Problem1684 prob = new Problem1684();
        System.out.println(prob.countConsistentStrings("ab", new String[]{"ad","bd","aaab","baa","badab"})); // 2
        System.out.println(prob.countConsistentStrings("abc", new String[]{"a","b","c","ab","ac","bc","abc"})); // 7
        System.out.println(prob.countConsistentStrings("cad", new String[]{"cc","acd","b","ba","bac","bad","ac","d"})); // 4
    }
}

@@ -204,488 +204,543 @@
     
- // TODO%0A        return 0;
+boolean%5B%5D charsAllowed = new boolean%5B26%5D;%0A        for (char c : allowed.toCharArray()) %7B
 %0A    
-%7D%0A%0A
     
-public static void main(String%5B%5D args) %7B%0A        Problem1684 prob = new Problem1684();%0A        System.out.println(prob.countConsistentStrings(%22ab%22, new String%5B%5D%7B%22ad%22,%22bd%22,%22aaab%22,%22baa%22,%22badab%22%7D)); // 2%0A        System.out.println(prob.countConsistentStrings(%22abc%22, new String%5B%5D%7B%22a%22,%22b%22,%22c%22,%22ab%22,%22ac%22,%22bc%22,%22abc%22%7D)); // 7%0A        System.out.println(prob.countConsistentStrings(%22cad%22, new String%5B%5D%7B%22cc%22,%22acd%22,%22b%22,%22ba%22,%22bac%22,%22bad%22,%22ac%22,%22d%22%7D)); // 4
+    charsAllowed%5Bc - 'a'%5D = true;%0A        %7D%0A        int answer = 0;%0A        for (String word : words) %7B%0A            boolean consistent = true;%0A            for (char c : word.toCharArray()) %7B%0A                if (!charsAllowed%5Bc - 'a'%5D) %7B%0A                    consistent = false;%0A                    break;%0A                %7D%0A            %7D%0A            if (consistent) %7B%0A                answer++;%0A            %7D%0A        %7D%0A        return answer;
 %0A   

Solve problem 1684