C++ || Easiest Solution || Substring
\n// The easiest solution to this problem is:\n// Step 1: Calculate length of "pref"\n// Step 2: find substring of "words" from 0 to length of "pref"\n// if bot
```\n// The easiest solution to this problem is:\n// Step 1: Calculate length of "pref"\n// Step 2: find substring of "words" from 0 to length of "pref"\n// if both match increment count by 1;\n\n\n\nclass Solution {\npublic:\n    int prefixCount(vector<string>& words, string pref) {\n        \n        int count=0;\n        int preflen=pref.size();        //step 1\n        \n        for(auto i:words){\n            if(i.substr(0,preflen) == pref)     //step 2\n                count++;                        //if both matches then increment count by 1\n            \n        }\n        return count;   //return count\n        \n    }\n};\n```\nPlease Upvote, if you liked my solution.\nDont forget to visit my repo: https://github.com/tarunsahnan/LeetCode-Solutions
['C']