You are given a set of strings. You have to find the length of the Optimal Superstring for this set.
Note:
1. A string is said to be the Superstring of a set of strings if all the strings of the set are present in it as a substring.
2. A Superstring is said to be an Optimal Superstring if its length is minimum out of all possible Superstrings for a given set of strings.
3. Each string of the set consists of the uppercase English alphabet.
Input Format:
The first line of the input contains an integer 'N', denoting the size of the set.
The following 'N' lines contain one string denoting the strings, part of the given set.
Output Format:
For each test case, print a single line containing a single integer denoting the length of the optimal Superstring.
The output of each test case will be printed in a separate line.
Note:
You don't have to print anything, it has already been taken care of. Just Implement the given function.
Constraints:
1 <= N <= 14
1 <= |Si| <= 100
Time Limit: 1 sec.