Given a string s and an array of strings words, determine whether s is a prefix string of words.

A string s is a prefix string of words if s can be made by concatenating the first k strings in words for some positive k no larger than words.length.

Return true if s is a prefix string of words, or false otherwise.

&nbsp;
Example 1:

Input: s = "iloveleetcode", words = ["i","love","leetcode","apples"]
Output: true
Explanation:
s can be made by concatenating "i", "love", and "leetcode" together.


Example 2:

Input: s = "iloveleetcode", words = ["apples","i","love","leetcode"]
Output: false
Explanation:
It is impossible to make s using a prefix of arr.

&nbsp;
Constraints:


	1 &lt;= words.length &lt;= 100
	1 &lt;= words[i].length &lt;= 20
	1 &lt;= s.length &lt;= 1000
	words[i] and s consist of only lowercase English letters.


class Solution:
    def isPrefixString(self, s: str, words: List[str]) -> bool:
        
        a = ''
    
        for i in words:
            
            a += i
            
            if a == s:
                return True
            if not s.startswith(a):
                break
                     
        return False 
class Solution {
    public boolean isPrefixString(String s, String[] words) {
        StringBuilder res = new StringBuilder ("");
        for (String word : words) {
            res.append (word);
            if (s.equals (res.toString()))
                return true;
            if (s.indexOf (res.toString()) == -1)
                return false;
        }
        return false;
    }
}
class Solution {
public:
    bool isPrefixString(string s, vector<string>& words) {
        string n="";
        for(string str:words){
            for(char ch:str){
                n+=ch;
            }
            if(n==s){
                return true;
            }
        }
        
        return false;
    }
};
var isPrefixString = function(s, words) {
    let str = words[0];
    if(s === words[0]){
        return true;
    }
    for(let i=1; i < words.length; i++){
        if(s === str){
            return true;
        }
        if( s.startsWith(str)){
            str += words[i];
            continue;
        }else{
            return false;
        }
    }
    if(s !== str){
            return false;
        }
    return true;
};
Check If String Is a Prefix of Array