← 返回 meta 的题目列表Maximum Unique Characters (Concatenation)
类型:online_judge
Coding: Maximum Length of a Concatenation With All Unique Characters
Given an array of strings arr, you may choose any number of strings and concatenate them in any order to form a new string s.
Constraint: all characters in s must be unique (each character appears at most once).
Return the maximum possible length of such a string s.
I/O
Input:
First line: integer n (size of the array).
Next n lines: one string arr[i] per line.
Output: an integer (the maximum length).
Constraints
1 <= n <= 16
1 <= len(arr[i]) <= 26
arr[i] contains only lowercase letters a-z.
Example
Input:
4
un
iq
a
ue
Output:
4
Explanation: choosing "un" + "iq" forms "uniq" of length 4 with all unique characters.
Example
Input
4
un
iq
a
ue
Output
4