folks, I am using the count function for counting the occurrence of substring in the main string it works fine but in one test case when I rented BANANA its give me one logical error as in BANANA substring ANA occurs twice but show only one time here is my code and result. Need guidance for a better understanding of why its hoping
enter code here
stuart=[]
kevin=[]
def minion_game(string):
score_stuart=0
score_kevin=0
data=['A','E','I','O','U']
result=[string[i:j] for i in range(len(string)+1) for j in range(i+1,len(string)+1)]
for i in range(len(result)):
if result[i].startswith(tuple(data)):
if result[i] not in Kevin:
kevin.append(result[i])
else:
if result[i] not in stuart:
stuart.append(result[i])
for i in range(len(kevin)):
str_temp=string.count(kevin[i])
print(kevin[i],str_temp)
score_kevin += int(str_temp)
for i in range(len(stuart)):
str_temp=string.count(stuart[i])
score_stuart += int(str_temp)
print('Kevin' ,score_kevin)
print('Stuart',score_stuart)
if __name__ == '__main__':
s = input()
minion_game(s)