What is the time complexity of this short program? I'm thinking it's linear, but then again, in the if statement there's a Python slice. I'm wondering how it would contribute to the complexity:
def count_s(string, sub):
i = 0
j =len(sub)-1
count = 0
while j < len(string):
if string[i:j+1] == sub:
count = count + 1
j = j + 1
i = i + 1
else:
i = i + 1
j = j + 1
return count