Minimum Number of Valid Strings to Form Target I

You are given an array of strings words and a string target.

A string x is called valid if x is a prefix of any string in words.

Return the minimum number of valid strings that can be concatenated to form target. If it is not possible to form target, return -1.

Examples
Input: [["abc","aaaaa","bcdef"],"aabcdabc"]
Output: 3
Hints

Minimum Number of Valid Strings to Form Target I

You are given an array of strings `words` and a string `target`.