You get an array of strings arr. You may pick any of the strings (none, some or all of them) and join them one after another, in the same order as in arr.
The joined string is valid if no letter appears in it more than once.
Return the length of the longest valid joined string.
Examples
Example 1:
Input: arr = ["ab","cd","bc"]
Output: 4
Explanation: "ab" + "cd" = "abcd" is valid and has 4 letters. "bc" can not join with "ab" or "cd", because a letter would repeat.
Example 2:
Input: arr = ["xy","xyz","a"]
Output: 4
Explanation: "xyz" + "a" = "xyza" has length 4. "xy" and "xyz" can not be used together.
Example 3:
Input: arr = ["aa","bb"]
Output: 0
Explanation: Each string already repeats a letter, so none of them can be used. The empty string has length 0.