Related: Repeated Substring Pattern
I solved this problem using Brute Force, but the Knuth Morris Pratt Algorithm is the official way to do this problem. In fact, this problem is quite literally that problem.
References
https://leetcode.com/problems/find-the-index-of-the-first-occurrence-in-a-string/ Knuth Morris Pratt Algorithm