 Counting words with a given prefix using Java || Beats 100.00% 
IntuitionIn the given question this is clearly mention that Return the number of strings in words that have pref as a prefix. A prefix of a string s is any lead
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
In the given question this is clearly mention that Return the **number of strings** in words that have pref as a prefix. A prefix of a string s is any leading contiguous substring of s.

# Approach
<!-- Describe your approach to solving the problem. -->
- **Parameters:** This method takes two parameters:
    - words: An array of strings representing the words to be checked.
    - pref: A string representing the prefix that we want to check each word for.

- **Logic:**

  - The method initializes a count variable to zero. This will keep track of how many words in the words array start with the pref string.
  - The method iterates over each word in the words array. For each word, it checks if the word starts with the pref prefix using the startsWith method (which returns true if the word starts with the given prefix).
  - If the word starts with the prefix, the method increments the count by 1.
  - After all words are checked, the method returns the final count, which represents the number of words that start with the given prefix.

# Complexity
- Time complexity: O(n)
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

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

# Code
```java []
class Solution {
    public int Count(String[] words, String pref) {
        int count=0;
        int len=words.length;
        for(int i=0;i<len;i++){
            if(words[i].startsWith(pref)){
                count++;
            }
        }
        return count;
    }
    public int prefixCount(String[] words, String pref) {
        return Count(words,pref);
    }
}
```
['Array', 'String', 'String Matching', 'Java']