checkPair-2 || C++.
IntuitionWe need to count the pairs of numbers in a list that can become identical by swapping exactly two digits within the numbers, for that we need t to tran
# Intuition
We need to count the pairs of numbers in a list that can become identical by swapping exactly two digits within the numbers, for that we need t to transform each number into a string of uniform length by padding with zeros, and then generate all possible variants of the number obtained by swapping two digits at a time. For each number, we check if any of its swapped variants has appeared before, using a map to keep track of the count of each number (including all its swapped variants).

# Approach
First, we determine the number of digits required to represent the largest number in the input list, this helps us to reduce the time complexity of the code. For each number in the list, we convert it into a string and generate all possible unique swapped versions by swapping two digits at a time. These variants are generated through nested loops that consider each pair of digits and perform the swaps. Once we have all swapped variants, we check if any of them have been encountered before by looking them up in a map, updating the result by adding the count of previous occurrences. The map mpp stores the frequency of each transformed number, while the set `st` temporarily holds all swapped variants of a number. 

# Complexity
- Time complexity:
O(n * d^4)

- Space complexity:
O(n + d^4)

# Code
```cpp []
class Solution {
public:
    int countPairs(vector<int>& nums) {
        int digits = to_string(*max_element(nums.begin(), nums.end())).size();
        int res = 0;
        unordered_map<string, int> mpp;
        unordered_set<string> st;
        string t = "0000000";
        for (auto it : nums) {
            string x = to_string(it);
            x = t.substr(0, digits - x.size()) + x;
            st = helper(x, digits);
            for (auto s : st) {
                if (mpp.count(s))
                    res += mpp[s];
            }
            mpp[x]++;
        }
        return res;
    }
    unordered_set<string> helper(string num, int d) {
        unordered_set<string> swapped;
        string s = num;
        swapped.insert(s);
        for (int i = 0; i < d - 1; i++) {
            for (int j = i + 1; j < d; j++) {
                if (s[i] != s[j]) {
                    swap(s[i], s[j]);
                    swapped.insert(s);
                }
                for (int x = 0; x < d - 1; x++) {
                    for (int y = x + 1; y < d; y++) {
                        if (s[x] != s[y]) {
                            swap(s[x], s[y]);
                            swapped.insert(s);
                            swap(s[x], s[y]);
                        }
                    }
                }
                swap(s[i], s[j]);
            }
        }
        return swapped;
    }
};
```
['C++']