Simple solution in Java. Beats 97.76 %
Complexity

Time complexity:
O(1)


Space complexity:
O(1)

Code
# Complexity
- Time complexity:
O(1)

- Space complexity:
O(1)

# Code
```java []
class Solution {
    public boolean canBeEqual(String s1, String s2) {
        char[] evens1 = { s1.charAt(0), s1.charAt(2) };
        char[] evens2 = { s2.charAt(0), s2.charAt(2) };
        char[] odds1 = { s1.charAt(1), s1.charAt(3) };
        char[] odds2 = { s2.charAt(1), s2.charAt(3) };
        Arrays.sort(evens1);
        Arrays.sort(evens2);
        Arrays.sort(odds1);
        Arrays.sort(odds2);
        return Arrays.equals(evens1, evens2) && Arrays.equals(odds1, odds2);
    }
}
```
['String', 'Java']