Easy C++ | Beats 100%
Intuition
You are allowed to swap between indices 0 and 2 or indices 1 and 3.
If the strings are already equal, there's no need for any swap.
Approach
If s1 and
# Intuition
1. You are allowed to swap between indices 0 and 2 or indices 1 and 3.
2. If the strings are already equal, there's no need for any swap.

# Approach
1. If s1 and s2 already match, you’re done. 
2. Otherwise, try swapping s1[i] and s1[i+2] (since only these pairs are allowed to swap). After each swap, check if they’re happy (i.e., s1 == s2).
3. If nothing works, too bad—they’ll stay mismatched.
# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```cpp []
class Solution {
public:
    bool canBeEqual(string s1, string s2) {
        if ( s1 == s2) {
            return true; // no need to swap they're happy
        }
        // try swapping
        for (int i = 0; i < 2; i++) {
            if (s1[i] != s2[i]) { // aahhh !! mismatch items
                swap(s1[i], s1[i + 2]); // swap items
                if (s1== s2) return true; // check if they're happy now :D
            }
        }
        return false; // sadly not happy :(
    }
};
```
['C++']