Python Count Repeated Substring