← All problemsSign in

Spell Shortening

CodeChefRating 1192Open on judge ↗

Chef is attempting to learn magic, but it really hasn't been going very well. In order to pass an upcoming exam, Chef decides to just memorize magic spells - but even that turns out to be too hard! A *magic spell* is, quite simply, a string that consists of only lowercase Latin letters (i.e, the characters $\{\texttt{a,b,c}\ldots,\texttt{z}\}$). Chef has with him a magic spell $S$, and is stru

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