simplest and easy to understand O(n) solution
Complexity\n- Time complexity: O(n)\n- Space complexity: O(n) \n\n# Code\n\nclass Solution {\n    func similarPairs(_ words: [String]) -> Int {\n        var mul
# Complexity\n- Time complexity: $$O(n)$$\n- Space complexity: $$O(n)$$ \n\n# Code\n```\nclass Solution {\n    func similarPairs(_ words: [String]) -> Int {\n        var multyset = [Set<Character>: Int]()\n        var answer: Int = 0\n        for word in words {\n            var wordSet = Set(word)\n            let counter = multyset[wordSet, default: 0]\n            answer += counter\n            multyset[wordSet] = counter + 1\n        }\n        return answer\n    }\n}\n```
['Swift']