Given a set of strings, **A** of length **N**.

Return the length of the smallest string which has all the strings in the set as a substring.

**Example**:

`Input 1:`

A = ["aaaa", "aa"]

Output 1:

4

Explanation 1:

Shortest string: "aaaa"

Input 2:

A = ["abcd", "cdef", "fgh", "de"]

Output 2:

8

Explanation 2:

Shortest string: "abcdefgh"

Your Input :

`["CS","seems","good"]`