Dashboard Temp Share Shortlinks Frames API

HTMLify

Day 105
Views: 3 | Author: djdj
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
class Solution {

    /**
     * @param String[] $words
     * @param String $pref
     * @return Integer
     */
    function prefixCount($words, $pref) {
        $c=0;
        for($i=0;$i<count($words);$i++){
            if(substr($words[$i], 0, strlen($pref)) == $pref){
                $c++;
            }
        }
        return $c;
    }
}