You are given an array of strings words (0-indexed).

In one operation, pick two distinct indices i and j, where words[i] is a non-empty string, and move any character from words[i] to any position in words[j].

Return true if you can make every string in words equal using any number of operations, and false otherwise.

&nbsp;
Example 1:

Input: words = ["abc","aabc","bc"]
Output: true
Explanation: Move the first 'a' in words[1] to the front of words[2],
to make words[1] = "abc" and words[2] = "abc".
All the strings are now equal to "abc", so return true.


Example 2:

Input: words = ["ab","a"]
Output: false
Explanation: It is impossible to make all the strings equal using the operation.


&nbsp;
Constraints:


	1 &lt;= words.length &lt;= 100
	1 &lt;= words[i].length &lt;= 100
	words[i] consists of lowercase English letters.


class Solution:
    def makeEqual(self, words: List[str]) -> bool:
        map_ = {}
        for word in words:
            for i in word:
                if i not in map_:
                    map_[i] = 1
                else:
                    map_[i] += 1
        n = len(words)
        for k,v in map_.items():
            if (v%n) != 0:
                return False
        return True
class Solution {
    public boolean makeEqual(String[] words) {
        
        HashMap<Character, Integer> map = new HashMap<>();
        
        for(String str : words){
            
            for(int i=0; i<str.length(); i++){
                char ch = str.charAt(i);
                
                map.put(ch, map.getOrDefault(ch, 0) + 1);
            }
            
        }
        
        for(Character key : map.keySet()){
            
            int freq = map.get(key);
            if(freq % words.length!=0){
                return false;
            }
        }
        
        return true;
    }
}
class Solution {
public:
    bool makeEqual(vector<string>& words) {
        int mp[26] = {0};
        for(auto &word: words){
            for(auto &c: word){
                mp[c - 'a']++;
            }
        }
        
        for(int i = 0;i<26;i++){
            if(mp[i] % words.size() != 0) return false;
        }
        return true;      
    }
};
/**
 * @param {string[]} words
 * @return {boolean}
 */
var makeEqual = function(words) {

    let length = words.length

    let map = {}
    for( let word of words ) {
        for( let ch of word ) {
            map[ch] = ( map[ch] || 0 ) + 1
        }
    }

    for( let key of Object.keys(map)) {
        if( map[key] % length !=0 ) return false
    }

    return true

};
Redistribute Characters to Make All Strings Equal