SMARTEST way with JAVA(beats 77% / 75%)
\n\n# Code\n\nclass Solution {\n    public int similarPairs(String[] words) {\n        int pairs = 0;\n        Map<Set<Character>, Integer> list = new HashMap<>
\n\n# Code\n```\nclass Solution {\n    public int similarPairs(String[] words) {\n        int pairs = 0;\n        Map<Set<Character>, Integer> list = new HashMap<>();\n        for(String a: words){\n            Set<Character> newSet = new HashSet<>();\n            for(int b = 0; b < a.length(); b++){\n                newSet.add(a.charAt(b));\n            }\n            if(list.containsKey(newSet)) list.put(newSet, list.get(newSet)+1);\n            else list.put(newSet, 1);\n        }\n        for(Map.Entry<Set<Character>, Integer> entry: list.entrySet()){\n            int val = entry.getValue();\n            pairs += (val*(val-1))/2;\n        }\n        return pairs;\n    }\n}\n```
['Java']