Start be reading the assignment carefully - it may be different from the "summary" you gave us.
You need to find all the times that a string occurs inside another. So if you are looking for all occurrences of "hello" in "hello Mike, hello Jane, hello Peter" it would be there three times: "
hello
Mike,
hello
Jane,
hello
Peter" and the indices are the number of characters from the start of the string at which the substring appears:
hello Mike, hello Jane, hello Peter
^ ^ ^
| | |
| | --- 24
| --- 12
--- 0
Then ask yourself "How would I do this manually?".
You would look through the string looking for the "h" and checking if it was followed by an "e", then an "l", and so on. If it was, you've found a substring, so make a note of the start position.
Either way, you'd then move on to the next character and check again.
Work out in your head exactly what rules you need to follow, and try them out manually on several different strings and substrings. When you have rules that cover all the cases you can think of (including empty strings, whole matches, no matches, etc.) then think about how to computerise them.
If you are having problems getting started at all, then this may help:
How to Write Code to Solve a Problem, A Beginner's Guide[
^]