C++ easy to understand, used formula to count no of pairs
\n\n# Code\n\nclass Solution {\npublic:\n    int similarPairs(vector<string>& words) {\n        unordered_map<string, int> mp;\n \n        for(int i=0;i<words.s
\n\n# Code\n```\nclass Solution {\npublic:\n    int similarPairs(vector<string>& words) {\n        unordered_map<string, int> mp;\n \n        for(int i=0;i<words.size();i++){\n            string s=words[i];\n         sort(s.begin(),s.end());//sorted string\n            string s1(1, s[0]);\n            for(int i=1;i<s.size();i++){//removed dublicate characters in string\n                if(s[i]!=s1[s1.size()-1])\n                    s1+=s[i];\n            }\n            words[i]=s1;\n            mp[s1]++;//counted the no of occurance\n            \n        }\n    int cnt = 0;\n     for(auto i:mp){// no of pairs that can be formed by n is n(n-1)/2\n         int c= i.second;\n         c=c*(c-1)/2;\n         cnt+=c;\n     }\n    return cnt;\n    }\n};\n```
['C++']