class Solution {
public:
    /**
     * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
     *
     * 
     * @param s string字符串 
     * @param dic string字符串vector 
     * @return bool布尔型
     */
    bool wordDiv(string s, vector<string>& dic) {
        // write code here
        int i,j,k=0;
        int count = 0;
        for(i = 0;i<dic.size();i++)
        {
            if(dic[i].size()==1)
            {
                if(s.find(dic[i]))
                {
                    count++;
                    continue;
                }
            }
            for(j = 0;k<s.size();k++)
            {
                while(dic[i][j]==s[k]){
                    j++;
                    k++;
                }
                if(j>=dic[i].size()) {
                    count++;
                    break;
                }
                else j = 0;
            }
        }
        if(count == dic.size()) return true;
        return false;
    }
};