✅ Beats 100% || C++ || 0ms
IntuitionIf it is a prefix its index will be starting from 0.Approach
Put the word (string) through a loop and find the first occurence of the prefix in the thi
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
*If it is a prefix its index will be starting from 0.*
# Approach
<!-- Describe your approach to solving the problem. -->
* Put the word (string) through a loop and find the first occurence of the prefix in the this particular string and store that index if that index is == 0 then increase the count of the total no of strings having the prefix in them and then return it.
# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->
#### O(n.m)
     n -> no. of words
     m ->  avg. length of an word
- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->
####  O(1) 
# Code
```cpp []
class Solution {
public:
    int prefixCount(vector<string>& words, string pref) {
        int count=0;
        for(auto word: words){
            size_t index= word.find(pref);
            if(index==0){
                count++;
            }
        }
        return count;
    }
};
```
['C++']