simple c++ code 👻
Complexity

Time complexity:
O(n2)


Space complexity:
O(1)

Code
![Screenshot 2025-01-27 at 2.54.58 PM.png](https://assets.leetcode.com/users/images/7cbb411f-cde4-4b5e-af20-5c3310200d57_1737969990.480203.png)

# Complexity
- Time complexity:
$$O(n^2)$$

- Space complexity:
$$O(1)$$ 

# Code
```cpp []
class Solution {
public:
    int maximumNumberOfStringPairs(vector<string>& words) {
        int count = 0;
        string str;
        for (int i = 0; i < words.size(); i++) {
            for (int j = i + 1; j < words.size(); j++) {
                str = words[j];
                reverse(str.begin(), str.end());

                // each string count only once
                if (words[i] == str) {
                    count += 1;
                    break;
                }
            }
        }
        return count;
    }
};
```
['Array', 'String', 'Counting', 'C++']