Repeated String Match Leetcode Solution