Easy approach in java beats 99%
Intuition\nSince there are only two independent groups of characters, we can focus on checking if:\n\nThe group formed by s1[0] and s1[2] matches the group form
# Intuition\nSince there are only two independent groups of characters, we can focus on checking if:\n\nThe group formed by s1[0] and s1[2] matches the group formed by s2[0] and s2[2].\n\nSimilarly, the group formed by s1[1] and s1[3] matches the group formed by s2[1] and s2[3].\n\nIf both conditions are met, then s1 can be rearranged to match s2; otherwise, it\'s not possible.\n\n# Approach\nCheck if the characters at the positions 0 and 2 in s1 form the same set as those at 0 and 2 in s2.\n\nSimilarly, check for the characters at positions 1 and 3.\n\nIf both conditions are satisfied, return true; otherwise, return false.\n\n# Complexity\n- Time complexity: O(1)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```java []\nclass Solution {\n    public boolean canBeEqual(String s1, String s2) {\n        if (!isEqualGroup(s1.charAt(0), s1.charAt(2), s2.charAt(0), s2.charAt(2))) {\n            return false;\n        }\n        if (!isEqualGroup(s1.charAt(1), s1.charAt(3), s2.charAt(1), s2.charAt(3))) {\n            return false;\n        }\n\n        return true;\n    }\n\n    private boolean isEqualGroup(char a, char b, char x, char y) {\n        return (a == x && b == y) || (a == y && b == x);\n    }\n}\n\n```
['Java']