← All problemsSign in

Two Friends and Pastry

Dhruv and Sridharan are good friends. They both enjoy eating pastries. There are $N$ shops in the town of Haven which sell pastries. Each shop sells only one type of pastry. There can be at most 26 different varieties of pastries denoted by the lowercase English alphabets $(a,b...z).$ The shops are given as a **string** $S$, where $S_i$ denotes the type of pastry being sold by the $i$-th shop. S

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