You are given a string array words and a string s, where words[i] and s comprise only of lowercase English letters.

Return the number of strings in words that are a prefix of s.

A prefix of a string is a substring that occurs at the beginning of the string. A substring is a contiguous sequence of characters within a string.

&nbsp;
Example 1:

Input: words = ["a","b","c","ab","bc","abc"], s = "abc"
Output: 3
Explanation:
The strings in words which are a prefix of s = "abc" are:
"a", "ab", and "abc".
Thus the number of strings in words which are a prefix of s is 3.

Example 2:

Input: words = ["a","a"], s = "aa"
Output: 2
Explanation:
Both of the strings are a prefix of s. 
Note that the same string can occur multiple times in words, and it should be counted each time.

&nbsp;
Constraints:


	1 &lt;= words.length &lt;= 1000
	1 &lt;= words[i].length, s.length &lt;= 10
	words[i] and s consist of lowercase English letters only.


class Solution:
    def countPrefixes(self, words: List[str], s: str) -> int:
        return len([i for i in words if s.startswith(i)])
class Solution {
    public int countPrefixes(String[] words, String s) {
        int i = 0;
        int j = 0;
        int count = 0;
        for(int k = 0; k < words.length; k++){
            if(words[k].length() > s.length()){
                continue;
            }
            
            while(i < words[k].length() && words[k].charAt(i) == s.charAt(j)){
                i++;
                j++;
            }
            if(i == words[k].length()){
                count++;
            }
            i = 0;
            j = 0;
        }
        return count;
    }
}
class Solution {
public:
    int countPrefixes(vector<string>& words, string s) {
        int res = words.size();

        for (auto && word : words) {
            for (int i = 0; i < word.size(); i++) {
                if (s[i] != word[i]) {
                    res--;
                    break;
                }
            }
        }
        return res;
    }
};
var countPrefixes = function(words, s) {
  
    let cont = 0;
    
    for(i = 0; i < words.length; i++){
        for(j = 1; j <= s.length; j++){
            if(words[i] == s.slice(0, j)){
                cont++;
            }
        }        
    }
     return cont;
    
};
Count Prefixes of a Given String