← All problemsSign in

Lexio Swap

CodeChefRating 2251Open on judge ↗

You are given two strings $S$ and $T$, both of which contain only the letters '$A$' and '$B$'. You can perform the following operation on string $S$: - Choose an index $i$ $(1 \leq i \leq N-3$) such that $S_{i+1} = S_{i+2}$ and at the same time $S_i \neq S_{i+3}$. - Then, delete the characters at indices $i+1$ and $i+2$ from $S$. The two remaining parts are concatenated together. For example, if

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start