Loading repovive.com/problems/classics/40
Given a text string T and a pattern string P, find all occurrences of P in T.
Report the total number of matches and the starting positions (1-indexed) of each occurrence.
abcabcabc abc
The pattern abc appears in abcabcabc starting at positions 1, 4, and 7.
3 1 4 7
aaaa aa
The pattern aa appears in aaaa starting at positions 1, 2, and 3. Overlapping matches are counted.
3 1 2 3
abcdef xyz
The pattern xyz does not appear in abcdef, so there are no positions to print.
0