← All problemsSign in

String Break

CodeChefRating 2875Open on judge ↗

Given two strings $A$ and $B$, each of length $N$, where string $B$ is a [permutation](https://en.wikipedia.org/wiki/Permutation) of string $A$. You can perform the following operation on string $A$: 1. Break string $A$ into $3$ substrings (may be empty) $S_1$, $S_2$, and $S_3$ such that $S_1+S_2+S_3=A$, where $|S_1|, |S_2|, |S_3| \ge 0$; 2. Replace $A$ with $S_3+S_2+S_1$. Note that, $+$ denot

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