swift solution
swift\nclass Solution {\n    func maxLength(_ arr: [String]) -> Int {\n        var map = [String: Set<Character>](), ans = 0\n        for str in arr {\n        
```swift\nclass Solution {\n    func maxLength(_ arr: [String]) -> Int {\n        var map = [String: Set<Character>](), ans = 0\n        for str in arr {\n            let chars = Set<Character>(str)\n            if chars.count == str.count {\n                for (key, existedChars) in map {\n                    if existedChars.intersection(chars).isEmpty {\n                        let str = ""  + key  + str\n                        map[str] = existedChars.union(chars)\n                        ans = max(ans, str.count)\n                    }\n                }\n                map[str] = chars\n                ans = max(ans, str.count)\n                if ans == 26 { return 26 }\n            }\n        }\n        return ans\n    }\n}\n```
['Swift']