Repeated Substring Pattern Leetcode Solution