# 916.Word Subsets

• 示例 1：

`输入：A = ["amazon","apple","facebook","google","leetcode"], B = ["e","o"]输出：["facebook","google","leetcode"]`

示例 2：

`输入：A = ["amazon","apple","facebook","google","leetcode"], B = ["l","e"]输出：["apple","google","leetcode"]`
• 示例 3：

`输入：A = ["amazon","apple","facebook","google","leetcode"], B = ["e","oo"]输出：["facebook","google"]`
• 示例 4：

`输入：A = ["amazon","apple","facebook","google","leetcode"], B = ["lo","eo"]输出：["google","leetcode"]`
• 示例 5：

`输入：A = ["amazon","apple","facebook","google","leetcode"], B = ["ec","oc","ceo"]输出：["facebook","leetcode"]`
• 提示：

`1 <= A.length, B.length <= 100001 <= A[i].length, B[i].length <= 10A[i] 和 B[i] 只由小写字母组成。A[i] 中所有的单词都是独一无二的，也就是说不存在 i != j 使得 A[i] == A[j]。`

`class Solution {public:    vector<string> wordSubsets(vector<string>& A, vector<string>& B) {        int sizeA = A.size();        int sizeB = B.size();        vector<vector<int>> alphaA(sizeA,vector<int>(26,0));​        vector<int> alphaB1(26,0);        vector<string> result;        for(int i=0;i<sizeA;i++)        {            int sizeA1=A[i].size();            for(int j=0;j<sizeA1;j++)            {                alphaA[i][A[i][j]-'a']++;            }​        }            for(int i=0;i<sizeB;i++)        {            int sizeB1=B[i].size();            vector<int> alphaB0(26,0);            for(int j=0;j<sizeB1;j++)            {                alphaB0[B[i][j]-'a']++;            }            for(int j=0;j<26;j++)                alphaB1[j] = (alphaB0[j] > alphaB1[j])?alphaB0[j]:alphaB1[j];​        }​        for(int i=0;i<sizeA;i++)        {            int j=0;            for(j;j<26;j++)            {                if(alphaB1[j] > alphaA[i][j]) break;            }​​            if(j == 26)                result.push_back(A[i]);        }        return result;​​    }};`