ount the Number of Consistent Strings

PHOTO EMBED

Sat Oct 08 2022 08:30:04 GMT+0000 (Coordinated Universal Time)

Saved by @Ranjan_kumar #c++

class Solution {
public:
    int countConsistentStrings(string allowed, vector<string>& words) {
        int n1=allowed.size();
        int n2=words.size();
        int ans=0;
        for(int i=0;i<n2;i++)
        {
            int n3=words[i].size();
            int ci=0;
            for(int j=0;j<n3;j++)
            {
                bool f=false;
                for(int k=0;k<n1;k++)
                {
                    if(words[i][j]==allowed[k])
                    {
                        f=true;
                        break;
                    }
                }
                if(f==true) ci++;
            }
            if(ci==n3) ans++;
            
        }
        return ans;
    }
};
content_copyCOPY

good question

https://leetcode.com/problems/count-the-number-of-consistent-strings/