0MS || Beats 100% || Easy and Simple Java Solution 
🔍 Intuition:
We need to count how many strings in thewordsarray areprefixesof strings.
Aprefixmeans the string appears at thebeginningofs.
Example Understanding
## 🔍 Intuition:
- We need to count how many strings in the `words` array are **prefixes** of string `s`.
- A **prefix** means the string appears at the **beginning** of `s`.
- **Example Understanding:**  
  - **Input:** `words = ["a", "b", "ab", "abc"]`, `s = "abc"`
  - `"a"`, `"ab"`, and `"abc"` are **prefixes** of `"abc"`, so the answer is `3`.

---

## 🛠️ Approach:
1. **Iterate through each word** in `words`.
2. **Use `indexOf()`** to check if `s.indexOf(str) == 0`:
   - If true, it means the word appears at the start of `s` (is a prefix).
   - Increase the `count`.
3. **Return the final count**.

---

## ⏱️ Complexity Analysis:
- **Time Complexity:**  
  - Checking `s.indexOf(str)` takes **O(M)** (where `M` is the length of `str`).
  - We do this for each word in `words`, so **O(N * M)** (where `N` is the number of words).
  
- **Space Complexity:**  
  - **O(1)** → Only integer variables are used for counting.



# Code
```java []
class Solution {
    public int countPrefixes(String[] words, String s) {
      int count = 0;
      for(String str : words){
        if(s.indexOf(str)==0)
            count++;
        
      }
      return count;
    }
}
```
['Array', 'String', 'Java']