first and second of the same length, made of lowercase English letters.
In one move you pick either string and swap two of its characters whose positions are an even distance apart (for example, positions 1 and 5, or 0 and 2). You may make any number of moves, including none.
Return true if such moves can make the two strings identical, and false otherwise.first="lemon", second="nomel" → True
In both strings the even positions hold l, m, n and the odd ones hold e and o, so rearranging within each group makes them equal.
first="abab", second="baba" → False
A letter on an even position can never move to an odd one. first has two a's on even positions, second has two b's.
first="lemon", second="nomel"
True
Run checks the first 3 tests in your browser. Submit checks all 109 tests on the server, hidden ones included.