VOVELS = set('AEIOU')
def count_ov(sub, inp, offset):
res = 0
while True:
res_idx = inp.find(sub, offset)
if res_idx > -1:
res += 1
offset = res_idx + 1
else:
break
return res
def minion_game(inp):
kev = 0
history = set()
len_inp = len(inp)
for idx, char in enumerate(inp):
if char in VOVELS:
for slen in range(1, len_inp - idx + 1):
sub = inp[idx:idx + slen]
if sub not in history:
kev += count_ov(sub, inp, idx)
history.add(sub)
#print('Kevin', kev)
st = 0
history = set()
for idx, char in enumerate(inp):
if char not in VOVELS:
for slen in range(1, len_inp - idx + 1):
sub = inp[idx:idx + slen]
if sub not in history:
st += count_ov(sub, inp, idx)
history.add(sub)
if st > kev:
print('Stuart', st)
elif st < kev:
print('Kevin', kev)
else:
print('Draw')
if __name__ == '__main__':