The naive approach, which is the first thing that came to my mind, is to use some sort of backtracking to generate all subsets of the given set of strings and then to find the subset with the maximum number of strings that satisfies the condition. But I don`t believe it is ok, because for large numbers of strings the exponential nature of bkt (2^n subsets) will severely affect the time of execution.
Any other ways to find the maximum number of strings from the given list of strings, so that if you concatenate them the property is satisfied, would be welcomed.