Simple C++ Solution
\n\n# Complexity\n- Time complexity:\nO(n)\n\n- Space complexity:\nO(1)\n\n# Code\n\nclass Solution {\npublic:\n    bool canBeEqual(string s1, string s2) {\n   
\n\n# Complexity\n- Time complexity:\n$$O(n)$$\n\n- Space complexity:\n$$O(1)$$\n\n# Code\n```\nclass Solution {\npublic:\n    bool canBeEqual(string s1, string s2) {\n        int f=0;\n        for(int i=0;i<2;i++){\n            if(s1[i]==s2[i] || s1[i]==s2[i+2]){\n                continue;\n            }\n            else{\n                f=1;\n            }\n        }\n        for(int i=3;i>1;i--){\n            if(s1[i]==s2[i] || s1[i]==s2[i-2]){\n                continue;\n            }\n            else{\n                f=1;\n            }\n        }\n        return f==1? false : true;\n    }\n};\n```
['String', 'C++']