Frequency Counter | C++ | Java
Intuition and approach\nCount frequency of every character in given words array if frequency of a character is not zero it should be divisible by size of words 
# Intuition and approach\nCount frequency of every character in given words array if frequency of a character is not zero it should be divisible by size of words array i.e. this character should be evenly distributed among the words in words array.\n\n# Complexity\n- Time complexity:\nO(n), n is size of words array\n- Space complexity:\nO(26)\n\n# Code\nC++\n```\nclass Solution {\npublic:\n    bool makeEqual(vector<string>& words) {\n        vector<int> freq(26);\n        for(auto &word : words){\n            for(char c : word){\n                freq[c-\'a\']++;\n            }\n        }\n        int sz = words.size();\n        for(int indx = 0; indx < 26; indx++){\n            if(freq[indx] && freq[indx] % sz != 0)return false;\n        }\n        return true;\n    }\n};\n```\nJava\n```\nclass Solution {\n    public boolean makeEqual(String[] words) {\n        int freq[] = new int[26];\n        for(var word : words){\n            for(var c : word.toCharArray()){\n                freq[c-\'a\']++;\n            }\n        }\n        int sz = words.length;\n        for(int indx = 0; indx < 26; indx++){\n            if(freq[indx] != 0 && freq[indx] % sz != 0)return false;\n        }\n        return true;\n    }\n}\n```
['C++', 'Java']