Simple C++ solution
If only unique characters\nThis approach will fails in case we have duplicate characters in string\n\nclass Solution {\npublic:\n    bool canBeEqual(string s1, 
# If only unique characters\nThis approach will fails in case we have duplicate characters in string\n```\nclass Solution {\npublic:\n    bool canBeEqual(string s1, string s2) {\n        if(s1==s2){\n            return true;\n        }\n        unordered_map<char,int> mp;\n        for(int i=0;i<s1.size();i++){\n            mp[s1[i]]=i;\n        }\n        for(int i=0;i<s2.size();i++){\n            if(mp[s2[i]]%2!=i%2){\n                return false;\n            }\n        }\n        return true;\n    }\n};\n```\n# Swapping the characters\nAs we are given that we can swap or j-i=2 i.e. we can swap 0,2 and 1,3. Also we are given string length as 4, so we can swap and check.\n```\nclass Solution {\npublic:\n    bool canBeEqual(string s1, string s2) {\n        if(s1[0]!=s2[0]){\n            swap(s1[0],s1[2]);\n        }\n        if(s1[1]!=s2[1]){\n            swap(s2[1],s2[3]);\n        }\n        return s1==s2;\n    }\n};\n```\n# Tracking the count for both strings\nWith this approach as we know that if we are going to swap a character which is at even position even after swapping the index will be even only and the same goes for odd index.\n```\nclass Solution {\npublic:\n    bool canBeEqual(string s1, string s2) {\n        int n=s1.size();\n        if(s1==s2){\n            return true;\n        }\n        vector<int> even(26,0),odd(26,0);\n        for(int i=0;i<n;i++){\n            if(i%2==0){\n                even[s1[i]-\'a\']++;\n                even[s2[i]-\'a\']--;\n            }\n            else{\n                odd[s1[i]-\'a\']++;\n                odd[s2[i]-\'a\']--;\n            }\n        }\n        for(int i=0;i<26;i++){\n            if(even[i] || odd[i]){\n                return false;\n            }\n        }\n        return true;\n    }\n};\n```
['C++']