C++ | Clean | Explanation | O(n)
\nclass Solution {\npublic:\n    int numOfPairs(vector<string>& nums, string target) {\n        unordered_map<string, int> mp;\n        for (string s : nums) mp
```\nclass Solution {\npublic:\n    int numOfPairs(vector<string>& nums, string target) {\n        unordered_map<string, int> mp;\n        for (string s : nums) mp[s]++;\n        int ret = 0;\n        for (string prefix : nums) {\n            if (target.substr(0, prefix.length()) != prefix) continue;\n            string suffix = target.substr(prefix.length());\n            if (mp.find(suffix) == mp.end()) continue;\n            int c = mp[suffix];\n            ret += (prefix == suffix ? c-1 : c);\n        }\n        return ret;\n    }\n};\n\n/**\n\nBrute Force: N(n^2)\n\nUsing Hash Set: O(n)\n====================\n1. First count all items and put in map.\n2. Traverse the array. Find remaining suffix in map.\n3. If map gives us count C add C into result.\n4. Exception: If prefix and suffix are same then add C-1 into result.\n\n**/\n```
['C']