Program for finding a specific name that is in continous no of times. E.g 'yaweryaweryaweraliyawer' here yawer is for 3 maximum no of times continously.
##Created a string to checking for a specific name successive no of times.
string = 'yaweraliyaweryaweryawer'
##this is the name to find
name = 'yawer'
##max no of times name is in the string
count = string.count(name)
##reverse loop for checking
for i in range(count,0,-1):
if name * count in string:
print(f"No of successive times {name} is in string is : {count})
break;
you are almost there, just remove name*count with counter "i"
like this:
for i in range(count,0,-1):
if name * i in string:
print(f"No of successive times {name} is in string is : {i}")
break;