ads;
Complexity
Time complexity:
O(N*M)
N=size of words array
M=max length of word in words array

Space complexity:
O(1)
Code
![image.png](https://assets.leetcode.com/users/images/2c97a7a0-0106-48ad-b16b-41297a3d5b48_1736385846.3465495.png)

# Complexity
- Time complexity:
O(N*M)
N=size of words array
M=max length of word in words array
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
O(1)
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```cpp []
class Solution {
public:
    int countPrefixes(vector<string>& words, string s) {
    int n=words.size();
    int count=0;
    for(int i=0;i<n;i++){
        string word=words[i];
        if(s.find(word)==0) count++;
    }  
    return count;   
    }
};
```
['C++']