Count Pairs Of Similar Strings Solution in C++
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\nO(n^3)\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\nO(1)\n# Code\n```\nclass Solution {\npublic:\n    int similarPairs(vector<string>& words) {\n        int i, j, k, count=0;\n        for(i=0 ; i<words.size() ; i++)\n        {\n            for(j=0 ; j<words[i].length() ; j++)\n            {\n                k=j+1;\n                while(k<words[i].size())\n                {\n                    if(words[i][j]==words[i][k])\n                    {\n                        words[i].erase(words[i].begin()+k);\n                    }\n                    else\n                    {\n                        k++;\n                    }\n                }\n            }\n            sort(words[i].begin(), words[i].end());\n        }\n        for(i=0 ; i<words.size() ; i++)\n        {\n            for(j=i+1 ; j<words.size() ; j++)\n            {\n                if(words[i]==words[j])\n                {\n                    count++;\n                }\n            }\n        }\n        return count;\n    }\n};\n```
['C++']