← All problemsSign in

Pen Pineapple Apple Pen

There are $K$ magical pens (numbered $1$ through $K$). You are given strings $P_1, P_2, \ldots, P_K$ (each of which consists of characters from **'a', 'b', ..., 't'**) ; for each valid $i$, the $i$-th pen can only write letters from the string $P_i$. You want to write a word $S$ of length $N$. All the characters of $S$ are between **'a'** and **'t'** inclusive. This string must be written from

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