Count Repeated Substring In Python