Simple Cpp Solution 
ApproachIterate through elements of words and just compare te starting characters of each word with the pref string.Complexity
Time complexity: O(n*m) where n =

# Approach
<!-- Describe your approach to solving the problem. -->
Iterate through elements of words and just compare te starting characters of each word with the pref string.

# Complexity
- Time complexity: O(n*m) where n = number of words and m = length of pref string
<!-- 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 prefixCount(vector<string>& words, string pref) {
        int ans=0;

        for(int i=0; i<words.size(); i++)
        {
            bool flag=true;
            for(int j=0; j<pref.length(); j++)
            {
                if(pref[j] != words[i][j])
                {    
                    flag=false;
                    break;
                }
            }

            if(flag) ans++;
        }

        return ans;
    }
};
```
['C++']