Java | HashSet | Sorting | Simple Solution
Code\n\nclass Solution {\n    public int similarPairs(String[] words) {\n        for(int i=0;i<words.length;i++){\n            String str = words[i];\n         
# Code\n```\nclass Solution {\n    public int similarPairs(String[] words) {\n        for(int i=0;i<words.length;i++){\n            String str = words[i];\n            HashSet<Character> set = new HashSet<>();\n            for(int j=0;j<str.length();j++){\n                set.add(str.charAt(j));\n            }\n            char arr[] = new char[set.size()];\n            Iterator<Character> itr = set.iterator();  \n            String temp = "";\n            while(itr.hasNext())  {  \n                temp=temp+Character.toString(itr.next());  \n            } \n            words[i]=temp;\n        }\n        int count=0;\n        for(int i=0;i<words.length-1;i++){\n            for(int j=i+1;j<words.length;j++){\n                if(words[i].equals(words[j]))\n                    count++;\n            }\n        }\n        return count;\n    }\n}\n```\n\nKindly upvote if you like the code.
['Array', 'String', 'Sorting', 'Java']