Pattern Positions
Given a string and patterns, find for each pattern the first position (1-indexed) where it appears in the string. Input The first input line has a string of length n. The next input line has an integer k: the number of patterns. Finally, there are k lines that describe the patterns. The string and the patterns consist of characters a–z. Output Print the first position for each pattern (or -1
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.
Sign in to chat with the tutor and save your progress.
Sign in to start