Kevin and Stuart want to play the 'The Minion Game'.

Game Rules

Both players are given the same string, $\mbox{S}$.

Both players have to make substrings using the letters of the string $\mbox{S}$.

Stuart has to make words starting with consonants.

Kevin has to make words starting with vowels. 

The game ends when both players have made all possible substrings.

Scoring

A player gets +1 point for each occurrence of the substring in the string $\mbox{S}$.

For Example:

String $\mbox{S}$ = BANANA

Kevin's vowel beginning word = ANA

Here, ANA occurs twice in BANANA. Hence, Kevin will get 2 Points.

For better understanding, see the image below: 

Your task is to determine the winner of the game and their score.

Function Description   

Complete the minion_game in the editor below.    

minion_game has the following parameters:   

string string: the string to analyze   

Prints   

string: the winner's name and score, separated by a space on one line, or Draw if there is no winner   

Input Format

A single line of input containing the string $\mbox{S}$. 

Note: The string $\mbox{S}$ will contain only uppercase letters: $\left[{\mbox{A}-\mbox{Z}}\right]$.  

Constraints

$0<len(S)\leq10^6$

Sample Input
BANANA

Sample Output
Stuart 12

Note : 

Vowels are only defined as $\textit{AEIOU}$. In this problem, $\mathbf{Y}$ is not considered a vowel.

Source: hackerrank | Difficulty: MEDIUM
Tags: String algorithms


Solutions:
s = input().strip()
vowels = set(['A', 'E', 'I', 'O', 'U'])
vscore = 0
cscore = 0
for i in range(len(s)):
	score = len(s) - i
	if s[i] in vowels:
		vscore += score
	else:
		cscore += score
if cscore > vscore:
	print('Stuart', cscore)
elif vscore > cscore:
	print('Kevin', vscore)
else:
	print('Draw')


import re
S = input()
maxlen = len(S)
stuart = 0
kevin = 0
vowels = ['A', 'E', 'I', 'O', 'U']
for i in range(0, maxlen):
	if S[i] in vowels:
		kevin += maxlen - i
	else:
		stuart += maxlen - i
if stuart > kevin:
	print('Stuart', stuart)
elif kevin > stuart:
	print('Kevin', kevin)
else:
	print('Draw')


vowels = 'AEIOU'
text = input().strip()
p1 = p2 = 0
for i in range(0, len(text)):
	if text[i] in vowels:
		p2 += len(text) - i
	else:
		p1 += len(text) - i
if p1 > p2:
	print('Stuart %d' % p1)
elif p2 > p1:
	print('Kevin %d' % p2)
else:
	print('Draw')


s = input()
n = len(s)
(lc, lv) = (0, 0)
for i in range(0, n):
	if s[i] in 'AEIOU':
		lv += n - i
	else:
		lc += n - i
if lc > lv:
	print('Stuart', lc)
elif lc == lv:
	print('Draw')
else:
	print('Kevin', lv)


import re
data = input()
stuart = 0
kevin = 0
num = len(data)
for x in data:
	if re.search('A|E|I|O|U', x):
		kevin = kevin + num
	else:
		stuart = stuart + num
	num = num - 1
if kevin > stuart:
	print('Kevin ' + str(kevin))
elif stuart > kevin:
	print('Stuart ' + str(stuart))
else:
	print('Draw')


s = input()
l = list(s)
vowels = 'AEIOU'
len_l = len(l)
wordcount = int(len_l * (len_l + 1) / 2)
Kevin = 0
for i in range(0, len_l):
	if s[i] in vowels:
		Kevin = Kevin + int(len_l - i)
Stuart = wordcount - Kevin
if Kevin == Stuart:
	print('Draw')
elif Kevin > Stuart:
	print('Kevin ' + str(Kevin))
else:
	print('Stuart ' + str(Stuart))


from collections import Counter
s = input().strip()
ls = len(s)
(player1, player2) = (0, 0)
for (id, c) in enumerate(s):
	if c in ('A', 'E', 'I', 'O', 'U'):
		player2 += ls - id
	else:
		player1 += ls - id
if player1 > player2:
	print('Stuart {:d}'.format(player1))
elif player1 == player2:
	print('Draw')
else:
	print('Kevin {:d}'.format(player2))


s = input()
words = {}
vowels = 'AEIOU'
stuart = kevin = 0
for i in range(len(s)):
	if s[i] in vowels:
		kevin += len(s) - i
	else:
		stuart += len(s) - i
if kevin > stuart:
	print('Kevin ' + str(kevin))
elif stuart > kevin:
	print('Stuart ' + str(stuart))
else:
	print('Draw')


s = input()

def win(t):
	(c, z) = (0, 0)
	for i in range(len(t)):
		if t[i] not in ['A', 'E', 'I', 'O', 'U']:
			c += len(t) - i
		else:
			z += len(t) - i
	return (c, z)
(o, p) = win(s)
if o == p:
	print('Draw')
elif o > p:
	print('Stuart', o)
else:
	print('Kevin', p)


S = input()
St = 0
Ke = 0
for i in range(len(S)):
	if S[i] in 'AEIOU':
		Ke = Ke + len(S) - i
	else:
		St = St + len(S) - i
if St > Ke:
	print('Stuart %i' % St)
elif Ke > St:
	print('Kevin %i' % Ke)
else:
	print('Draw')


import re
s = input()
l = len(s)
(kevin, stuart) = (0, 0)
for v in 'AEIOU':
	oc = [x.start() for x in re.finditer(v, s)]
	kevin += len(oc) * l - sum(oc)
for v in ['B', 'C', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'V', 'X', 'Z', 'W', 'Y']:
	oc = [x.start() for x in re.finditer(v, s)]
	stuart += len(oc) * l - sum(oc)
if kevin == stuart:
	print('Draw')
if kevin > stuart:
	print('Kevin ' + str(kevin))
if stuart > kevin:
	print('Stuart ' + str(stuart))


vowels = set('AEIOU')
stuart = kevin = 0
word = input()
for (i, c) in enumerate(word):
	if c in vowels:
		kevin += len(word) - i
	else:
		stuart += len(word) - i
if stuart > kevin:
	print('Stuart', stuart)
elif kevin > stuart:
	print('Kevin', kevin)
else:
	print('Draw')


teststr = input().strip()
stuart = 0
kevin = 0
for (i, x) in enumerate(teststr):
	if x.upper() in 'AEIOU':
		kevin += len(teststr) - i
	else:
		stuart += len(teststr) - i
if kevin > stuart:
	print('Kevin {}'.format(kevin))
elif kevin < stuart:
	print('Stuart {}'.format(stuart))
else:
	print('Draw')


import re
S = input().rstrip().replace(' ', '')
N = len(S)
vowels = ('A', 'E', 'I', 'O', 'U')
(p1, p2) = (0, 0)
for i in range(N):
	if S[i] in vowels:
		p2 += N - i
	else:
		p1 += N - i
if p1 > p2:
	print('Stuart ' + str(p1))
elif p2 > p1:
	print('Kevin ' + str(p2))
else:
	print('Draw')


str = input()
sum = 0
total = 0
vowels = 'AEIOU'
for i in range(len(str)):
	if str[i] in vowels:
		sum += len(str) - i
	total += len(str) - i
if total - sum > sum:
	print('Stuart {}'.format(total - sum))
elif sum > total - sum:
	print('Kevin {}'.format(sum))
else:
	print('Draw')


pl1 = 0
pl2 = 0
con = ['B', 'C', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'V', 'X', 'Z', 'W', 'Y']
vow = ['A', 'E', 'I', 'O', 'U', 'Y']
s = input()
n = len(s)
for i in range(n):
	if s[i] in con:
		pl1 += n - i
	elif s[i] in vow:
		pl2 += n - i
if pl1 > pl2:
	print('Stuart', pl1)
elif pl2 > pl1:
	print('Kevin', pl2)
else:
	print('Draw')


word = input().strip()
from collections import defaultdict
word = list(enumerate(word[::-1], 1))
vok = 'aeiou'.upper()
b = sum((n for (n, b) in word if b not in vok))
a = sum((n for (n, b) in word if b in vok))
if a > b:
	print('Kevin', a)
elif b > a:
	print('Stuart', b)
else:
	print('Draw')


s = input()
n = len(s)
p1 = 0
p2 = 0
for i in range(0, n):
	if s[i] in 'AEIOUaeiou':
		p2 += n - i
	else:
		p1 += n - i
if p1 > p2:
	print('Stuart', p1)
elif p2 > p1:
	print('Kevin', p2)
else:
	print('Draw')


t = [0] * 2
for (x, c) in enumerate(reversed(input()), start=1):
	t[1 if c in 'AEIOU' else 0] += x
print('Stuart {}'.format(t[0]) if t[0] > t[1] else 'Kevin {}'.format(t[1]) if t[1] > t[0] else 'Draw')


def isConOrVow(c, con):
	vow = c in ('e', 'u', 'i', 'o', 'a')
	if con:
		return not vow
	else:
		return vow
s = input().lower()
n = len(s)
sc = 0
for (j, c) in enumerate(s):
	if isConOrVow(c, True):
		sc += n - j
sv = 0
for (j, c) in enumerate(s):
	if isConOrVow(c, False):
		sv += n - j
if sc > sv:
	print('Stuart', sc)
elif sv > sc:
	print('Kevin', sv)
else:
	print('Draw')


s = input()
p1 = 0
p2 = 0
for i in range(len(s)):
	if s[i] in 'AEIOU':
		p2 += len(s) - i
	else:
		p1 += len(s) - i
if p1 > p2:
	print('Stuart ' + str(p1))
elif p2 > p1:
	print('Kevin ' + str(p2))
else:
	print('Draw')


vowels = {'A', 'E', 'I', 'O', 'U'}

def player1(s):
	sm = 0
	n = len(s)
	for i in range(len(s)):
		if s[i] not in vowels:
			sm += n - i
	return sm

def player2(s):
	sm = 0
	n = len(s)
	for i in range(len(s)):
		if s[i] in vowels:
			sm += n - i
	return sm
string = input()
(Kevin, Stuart) = (player2(string), player1(string))
if Kevin > Stuart:
	print('Kevin', Kevin)
elif Kevin < Stuart:
	print('Stuart', Stuart)
else:
	print('Draw')


s = input()
(stuart_score, kevin_score) = (0, 0)
for i in range(len(s)):
	score = len(s) - i
	if s[i].lower() in 'aiueo':
		kevin_score += score
	else:
		stuart_score += score
if stuart_score > kevin_score:
	print('Stuart {0}'.format(stuart_score))
elif kevin_score > stuart_score:
	print('Kevin {0}'.format(kevin_score))
else:
	print('Draw')


S = input().strip().upper()
vowels = list('aeiou'.upper())
kev = 0
stu = 0
N = len(S)
for (k, s) in enumerate(S):
	if s in vowels:
		kev += N - k
	else:
		stu += N - k
if stu > kev:
	print('Stuart', stu)
elif stu < kev:
	print('Kevin', kev)
else:
	print('Draw')


st = input()
vowels = ['A', 'E', 'I', 'O', 'U']
scores = [0, 0]
l = len(st)
for i in range(0, l):
	words = l - i
	if st[i] in vowels:
		scores[1] += words
	else:
		scores[0] += words
if scores[0] > scores[1]:
	print('Stuart', scores[0])
elif scores[0] < scores[1]:
	print('Kevin', scores[1])
else:
	print('Draw')


s = 0
k = 0
vowels = 'aeiou'
inp = input()
for (index, i) in enumerate(reversed(inp)):
	if i.lower() in vowels:
		k += index + 1
	else:
		s += index + 1
if k > s:
	print('Kevin {}'.format(k))
elif s > k:
	print('Stuart {}'.format(s))
else:
	print('Draw')


S = input()
L = len(S)
p1 = p2 = 0
for i in range(L):
	if S[i] in ['A', 'E', 'I', 'O', 'U']:
		p2 += L - i
	else:
		p1 += L - i
if p1 == p2:
	print('Draw')
else:
	print('%s %d' % (('Kevin', p2) if p2 > p1 else ('Stuart', p1)))


vowels = ('A', 'E', 'I', 'O', 'U')

def playGame(word):
	kS = 0
	sS = 0
	for i in range(len(word)):
		if word[i] in vowels:
			kS += len(word) - i
		else:
			sS += len(word) - i
	return (kS, sS)

def main():
	word = input()
	(k, s) = playGame(word)
	if k > s:
		print('Kevin %s' % k)
	elif s > k:
		print('Stuart %s' % s)
	else:
		print('Draw')
main()


S = input()
vowels = 'AEIOU'
stuart_score = 0
kevin_score = 0
for i in range(len(S)):
	if S[i] in vowels:
		kevin_score += 1 * (len(S) - i)
	else:
		stuart_score += 1 * (len(S) - i)
if kevin_score > stuart_score:
	print('Kevin', kevin_score)
elif kevin_score < stuart_score:
	print('Stuart', stuart_score)
else:
	print('Draw')


s = str(input())
l = len(s)
x1 = 0
x2 = 0
for i in range(0, l):
	if s[i] == 'A' or s[i] == 'E' or s[i] == 'I' or (s[i] == 'O') or (s[i] == 'U'):
		x2 += l - i
	else:
		x1 += l - i
if x1 == x2:
	print('Draw')
elif x1 > x2:
	print('Stuart %d' % x1)
else:
	print('Kevin %d' % x2)


str = input()
consonants = 'QWRTYPSDFGHJKLZXCVBNM'
vowel = 'AEUIO'
c_score = 0
v_score = 0
n = len(str)
for (pos, letter) in enumerate(str):
	if letter in consonants:
		c_score += n - pos
	else:
		v_score += n - pos
if c_score > v_score:
	print('Stuart', c_score)
elif c_score == v_score:
	print('Draw')
else:
	print('Kevin', v_score)


vowels = ['A', 'E', 'I', 'O', 'U']

def minion_game(string):
	score_kevin = 0
	score_stuart = 0
	for ind in range(len(string)):
		if string[ind] in vowels:
			score_kevin += len(string) - ind
		else:
			score_stuart += len(string) - ind
	if score_kevin > score_stuart:
		return 'Kevin ' + str(score_kevin)
	elif score_kevin < score_stuart:
		return 'Stuart ' + str(score_stuart)
	else:
		return 'Draw'


s = input()
(p1, p2) = (0, 0)
n = len(s)
for i in range(n):
	if s[i:i + 1] in ('A', 'E', 'I', 'O', 'U'):
		p2 += n - i
	else:
		p1 += n - i
if p1 > p2:
	print('Stuart ' + str(p1))
elif p2 > p1:
	print('Kevin ' + str(p2))
else:
	print('Draw')


s = input()
vogals = 'AEIOU'
stuart = 0
kevin = 0
l = len(s)
for (ind, letter) in enumerate(s):
	if letter in vogals:
		kevin += l - ind
	else:
		stuart += l - ind
if stuart > kevin:
	print('Stuart', stuart)
elif stuart < kevin:
	print('Kevin', kevin)
else:
	print('Draw')


w = input()
vowels = set(['A', 'E', 'I', 'O', 'U'])
p1 = 0
p2 = 0
for lhs in range(len(w)):
	wi0 = w[lhs:lhs + 1]
	c = len(w) - lhs
	if wi0 in vowels:
		p2 += c
	else:
		p1 += c
if p1 > p2:
	print('Stuart ' + str(p1))
elif p2 > p1:
	print('Kevin ' + str(p2))
else:
	print('Draw')


import string
s = input().strip()
v = len(s)
stuart = 0
kevin = 0
vowel = ['A', 'I', 'U', 'E', 'O']
for i in range(v):
	if s[i] in vowel:
		kevin += v - i
	else:
		stuart += v - i
if kevin > stuart:
	print('Kevin', kevin)
elif stuart > kevin:
	print('Stuart', stuart)
else:
	print('Draw')


def consonants(instring):
	numchars = len(instring)
	score = 0
	for idx in range(numchars):
		if instring[idx] not in 'AEIOU':
			numsubchars = numchars - idx
			score += numsubchars
	return score

def vowels(instring):
	numchars = len(instring)
	score = 0
	for idx in range(numchars):
		if instring[idx] in 'AEIOU':
			numsubchars = numchars - idx
			score += numsubchars
	return score
instring = input()
p1score = consonants(instring)
p2score = vowels(instring)
if p1score > p2score:
	print('Stuart %d' % p1score)
elif p1score == p2score:
	print('Draw')
else:
	print('Kevin %d' % p2score)


str = input()
l = len(str)
stuart = 0
kevin = 0
for i in range(l):
	if str[i] in 'AEIOU':
		kevin += l - i
	else:
		stuart += l - i
if kevin > stuart:
	print('Kevin ' + '{0:d}'.format(kevin))
elif kevin < stuart:
	print('Stuart ' + '{0:d}'.format(stuart))
else:
	print('Draw')


import itertools

def where(x):
	return itertools.chain.from_iterable([[i] * j for (i, j) in enumerate(x)])
s = input()
L = len(s)
K = sum([L - x for x in where([y in 'AEIOU' for y in s])])
S = L * (L + 1) // 2 - K
if K == S:
	print('Draw')
elif K > S:
	print('Kevin', K)
else:
	print('Stuart', S)


s = input()
v = 'AEIOU'
c1 = 0
c2 = 0
for i in range(0, len(s)):
	if s[i] in v:
		c1 = c1 + (len(s) - i)
	else:
		c2 = c2 + (len(s) - i)
if c1 == c2:
	print('Draw')
elif c1 > c2:
	print('Kevin', c1)
else:
	print('Stuart', c2)


s = input()
l = len(s)
vowels = 'AEIOU'
p1 = p2 = 0
for i in range(l):
	if s[i] not in vowels:
		p1 += l - i
	else:
		p2 += l - i
if p1 > p2:
	print('Stuart ' + str(p1))
elif p1 < p2:
	print('Kevin ' + str(p2))
else:
	print('Draw')


s = input()
kevin = 0
stuart = 0
tmp = len(s)
for i in range(tmp):
	if s[i] in 'AEIOU':
		kevin += tmp - i
	else:
		stuart += tmp - i
if stuart > kevin:
	print('Stuart ' + str(stuart))
elif stuart < kevin:
	print('Kevin ' + str(kevin))
else:
	print('Draw')


s = str(input())
p1 = p2 = 0
l = len(s)
for i in range(l):
	if s[i] in ['A', 'E', 'I', 'O', 'U']:
		p2 = p2 + l - i
	else:
		p1 = p1 + l - i
if p1 > p2:
	print('Stuart ' + str(p1))
elif p2 > p1:
	print('Kevin ' + str(p2))
else:
	print('Draw')


def main():
	S = input()
	N = len(S)
	res2 = 0
	mom = {'A': True, 'E': True, 'I': True, 'O': True, 'U': True}
	for i in range(N):
		if mom.get(S[i], False):
			res2 += N - i
	res1 = N * (N + 1) // 2 - res2
	if res1 > res2:
		print('{0} {1}'.format('Stuart', res1))
	elif res1 < res2:
		print('{0} {1}'.format('Kevin', res2))
	else:
		print('Draw')
main()


vowels = ['A', 'E', 'I', 'O', 'U']
Stuart = 0
Kevin = 0
S = input().upper()
length = len(S)
for i in range(0, length):
	if S[i] in vowels:
		Kevin += length - i
	elif S[i] not in vowels:
		Stuart += length - i
if Kevin > Stuart:
	print('Kevin', Kevin)
elif Kevin < Stuart:
	print('Stuart', Stuart)
else:
	print('Draw')


import functools
s = input()
ss = 0
for i in range(len(s)):
	if s[i] in ['A', 'E', 'I', 'O', 'U']:
		ss += len(s) - i
bb = functools.reduce(lambda a, b: a + b, range(len(s) + 1)) - ss
if ss > bb:
	print('Kevin {}'.format(ss))
elif ss == bb:
	print('Draw')
else:
	print('Stuart {}'.format(bb))


def minion_game(string):
	n = len(string)
	(player1, player2) = (0, 0)
	for i in range(0, n):
		if string[i] in 'AEIOU':
			player1 += n - i
		else:
			player2 += n - i
	if player1 > player2:
		return 'Kevin ' + str(player1)
	elif player1 == player2:
		return 'Draw'
	else:
		return 'Stuart ' + str(player2)


S = input()
n = len(S)
(cons, vowel) = (0, 0)
for i in range(n):
	if S[i] in 'AEIOU':
		vowel += n - i
	else:
		cons += n - i
if cons == vowel:
	print('Draw')
elif cons > vowel:
	print('Stuart', cons)
else:
	print('Kevin', vowel)


s = input()
l = len(s)
vowels = 'AEIOU'
p1 = p2 = 0
for i in range(l):
	if s[i] not in vowels:
		p1 += l - i
	else:
		p2 += l - i
if p1 > p2:
	print('Stuart {}'.format(p1))
elif p1 < p2:
	print('Kevin {}'.format(p2))
else:
	print('Draw')


string = input()
conso = []
vow = []
n = len(string)
for i in range(n):
	if string[i].lower() in ['a', 'e', 'i', 'o', 'u']:
		vow.append(n - i)
	else:
		conso.append(n - i)
a = sum(conso)
b = sum(vow)
if a == b:
	print('Draw')
elif a > b:
	print('Stuart {}'.format(a))
else:
	print('Kevin {}'.format(b))


import re
vowels = ['A', 'E', 'I', 'O', 'U']
word = input()
used_words = set()
(stuart_words, kevin_words) = (0, 0)
(stuart, kevin) = (0, 0)
word_len = len(word)
for i in range(word_len):
	stuart += stuart_words
	kevin += kevin_words
	if word[i] in vowels:
		kevin_words += 1
		kevin += 1
	else:
		stuart_words += 1
		stuart += 1
if stuart > kevin:
	print('Stuart', stuart)
elif kevin > stuart:
	print('Kevin', kevin)
else:
	print('Draw')


s = input()
d = c = 0
f = len(s)
for i in range(0, len(s)):
	if s[i] == 'A' or s[i] == 'E' or s[i] == 'O' or (s[i] == 'I') or (s[i] == 'U'):
		c = c + f
	else:
		d = d + f
	f = f - 1
if d > c:
	print('Stuart ' + str(d))
if d < c:
	print('Kevin ' + str(c))
if d == c:
	print('Draw')


word = input()
strln = len(word)
sublen = strln
consonants = 0
vowels = 0
for i in range(strln):
	if word[i] in 'AEIOU':
		vowels += sublen
	else:
		consonants += sublen
	sublen -= 1
if consonants > vowels:
	print('Stuart %d' % consonants)
elif vowels > consonants:
	print('Kevin %d' % vowels)
else:
	print('Draw')


S = input()
s = 0
k = 0
for i in range(len(S)):
	if S[i] == 'A' or S[i] == 'E' or S[i] == 'I' or (S[i] == 'O') or (S[i] == 'U'):
		k += len(S) - i
	else:
		s += len(S) - i
if s == k:
	print('Draw')
elif k > s:
	print('Kevin ' + str(k))
else:
	print('Stuart ' + str(s))


stuart = 0
kevin = 0
s = input()

def is_vowel(c):
	return 'AEIOU'.find(c) != -1
for i in range(len(s)):
	if is_vowel(s[i]):
		kevin += len(s) - i
	else:
		stuart += len(s) - i
print('Stuart ' + stuart.__str__() if stuart > kevin else 'Kevin ' + kevin.__str__() if kevin > stuart else 'Draw')


z = {}
s = input()
n = len(s)
a = 0
b = 0
for j in range(n):
	i = s[j]
	k = n - j
	if i == 'A' or i == 'E' or i == 'I' or (i == 'O') or (i == 'U'):
		a += k
	else:
		b += k
if a == b:
	print('Draw')
elif a > b:
	print('Kevin ' + str(a))
else:
	print('Stuart ' + str(b))


def is_vowel(ch):
	vowels = ('a', 'e', 'i', 'o', 'u')
	return ch.lower() in vowels

def find_scores(word):
	size = len(word)
	(vowels, consonants) = (0, 0)
	for (i, ch) in enumerate(word):
		score = size - i
		if is_vowel(ch):
			vowels += score
		else:
			consonants += score
	return (vowels, consonants)

def main():
	word = input()
	(vowels, consonants) = find_scores(word)
	if vowels == consonants:
		print('Draw')
	elif vowels > consonants:
		print('Kevin', vowels)
	else:
		print('Stuart', consonants)
main()


def triangle(n):
	arr = [0]
	for i in range(n + 1):
		arr += [i + arr[-1]]
	return arr
word = input().lower()
length = len(word)
player1 = 0
player2 = 0
vowels = {'a', 'e', 'i', 'o', 'u'}
triList = triangle(length)
for i in range(length):
	if word[i] in vowels:
		player2 += length - i
	else:
		player1 += length - i
if player1 > player2:
	print('Stuart', player1)
elif player1 == player2:
	print('Draw')
else:
	print('Kevin', player2)


s = input()
cons = 'BCDFGHJKLMNPQRSTVWXYZ'
vowels = 'AEIOU'
Stuart = sum([len(s) - x for x in range(len(s)) if s[x] in cons])
Kevin = sum([len(s) - x for x in range(len(s)) if s[x] in vowels])
print('Stuart ' + str(Stuart)) if Stuart > Kevin else print('Kevin ' + str(Kevin)) if Kevin > Stuart else print('Draw')


s = input()
n = len(s)
p1 = 'Stuart'
p2 = 'Kevin'
cp1 = 0
cp2 = 0
vows = ['A', 'E', 'I', 'O', 'U']
startWithVow = False
wp1 = []
wp2 = []
total = n * (n + 1) // 2
for v in vows:
	p = 0
	index = s.find(v, p)
	while index != -1:
		m = len(s) - index
		cp2 += m
		p = index + 1
		index = s.find(v, p)
cp1 = total - cp2
if cp1 < cp2:
	print(p2 + ' ' + str(cp2))
elif cp1 > cp2:
	print(p1 + ' ' + str(cp1))
else:
	print('Draw')


vowels = 'AEIOU'
source = input()
st = 0
kv = 0
for i in range(len(source)):
	if source[i] not in vowels:
		st += len(source) - i
for i in range(len(source)):
	if source[i] in vowels:
		kv += len(source) - i
if st > kv:
	print('Stuart', st)
elif kv > st:
	print('Kevin', kv)
else:
	print('Draw')


def isVovel(letter):
	if letter == 'A' or letter == 'E' or letter == 'I' or (letter == 'O') or (letter == 'U'):
		return True
	return False

def countAllResult(word):
	sumK = 0
	sumS = 0
	for i in range(len(word)):
		if isVovel(word[i]):
			sumK = sumK + len(word) - i
		else:
			sumS = sumS + len(word) - i
	if sumS > sumK:
		print('Stuart ' + str(sumS))
	elif sumS < sumK:
		print('Kevin ' + str(sumK))
	else:
		print('Draw')

def countAllResultSlow(word):
	resultStuartDict = {}
	resultKevinDict = {}
	for i in range(len(word)):
		if isVovel(word[i]):
			data = ''
			for x in range(i, len(word)):
				data = data + str(word[x])
				if data in resultKevinDict:
					resultKevinDict[data] = resultKevinDict[data] + 1
				else:
					resultKevinDict[data] = 1
		else:
			data = ''
			for x in range(i, len(word)):
				data = data + str(word[x])
				if data in resultStuartDict:
					resultStuartDict[data] = resultStuartDict[data] + 1
				else:
					resultStuartDict[data] = 1
	sumK = 0
	for (k, v) in resultKevinDict.items():
		sumK = sumK + v
	sumS = 0
	for (k, v) in resultStuartDict.items():
		sumS = sumS + v
	if sumS > sumK:
		print('Stuart ' + str(sumS))
	elif sumS < sumK:
		print('Kevin ' + str(sumK))
	else:
		print('Draw')
word = input()
countAllResult(word)


S = input()
vowels = ['E', 'A', 'O', 'I', 'U']
score1 = 0
score2 = 0
l = len(S)
for i in range(0, len(S)):
	if S[i] in vowels:
		score2 += l - i
	else:
		score1 += l - i
if score1 > score2:
	print('Stuart', score1)
elif score2 > score1:
	print('Kevin', score2)
else:
	print('Draw')


game_text = input()
text_len = len(game_text)
vowels = 'AEIOU'
player_one = 0
player_two = 0
for i in range(text_len):
	if game_text[i] not in vowels:
		player_one += text_len - i
	else:
		player_two += text_len - i
if player_one > player_two:
	print('Stuart', player_one)
elif player_one < player_two:
	print('Kevin', player_two)
else:
	print('Draw')


S = input()
vowels = ['A', 'E', 'I', 'O', 'U']
countvowel = 0
countconso = 0
for i in range(len(S)):
	if S[i] in vowels:
		countvowel += len(S) - i
	if S[i] not in vowels:
		countconso += len(S) - i
if countconso > countvowel:
	print('Stuart', end=' ')
	print(countconso)
elif countconso < countvowel:
	print('Kevin', end=' ')
	print(countvowel)
else:
	print('Draw')


s = input()
N = len(s)
(c_count, v_count) = (0, 0)
i = 0
while i < N:
	if s[i] in ['A', 'E', 'I', 'O', 'U']:
		v_count += len(s) - i
	else:
		c_count += len(s) - i
	i += 1
if c_count == v_count:
	print('Draw')
elif c_count > v_count:
	print('Stuart ' + str(c_count))
else:
	print('Kevin ' + str(v_count))


s = input()
l = len(s)
i = 0
dictVow = 'AEIOU'
player1 = 0
player2 = 0
for i in range(0, l):
	if s[i] in dictVow:
		player2 += l - i
	else:
		player1 += l - i
if player1 == player2:
	print('Draw')
elif player1 > player2:
	print('Stuart ' + str(player1))
else:
	print('Kevin ' + str(player2))


s = input().strip()
player1 = 0
player2 = 0
for i in range(len(s)):
	if s[i] in 'AEIOU':
		player2 += len(s) - i
	else:
		player1 += len(s) - i
if player1 == player2:
	print('Draw')
elif player1 > player2:
	print('Stuart', player1)
else:
	print('Kevin', player2)


consonants = 'BCDFGHJKLMNPQRSTVWXYZ'
vowels = 'AEIOU'
word = input()
stuart_score = 0
kevin_score = 0
position_modifier = 1
for position in range(len(word) - 1, -1, -1):
	if word[position] in consonants:
		stuart_score += 1 * position_modifier
	else:
		kevin_score += 1 * position_modifier
	position_modifier += 1
if stuart_score > kevin_score:
	print('Stuart {0}'.format(stuart_score))
elif stuart_score < kevin_score:
	print('Kevin {0}'.format(kevin_score))
else:
	print('Draw')


s = input()
N = len(s)
V = set('AOUEI')
stuart = kevin = 0
for (i, x) in enumerate(s):
	if x in V:
		kevin += N - i
	else:
		stuart += N - i
if kevin > stuart:
	print('Kevin', kevin)
elif kevin < stuart:
	print('Stuart', stuart)
else:
	print('Draw')


s = input()
n = len(s)
player1 = 0
player2 = 0
for x in range(n):
	if s[x] in 'AEIOU':
		player2 += n - x
	else:
		player1 += n - x
if player1 > player2:
	print('Stuart ' + str(player1))
elif player2 > player1:
	print('Kevin ' + str(player2))
else:
	print('Draw')


__author__ = 'bishal'
s = input()
d = c = 0
f = len(s)
for i in range(0, len(s)):
	if s[i] == 'A' or s[i] == 'E' or s[i] == 'O' or (s[i] == 'I') or (s[i] == 'U'):
		c = c + f
	else:
		d = d + f
	f = f - 1
if d > c:
	print('Stuart ' + str(d))
if d < c:
	print('Kevin ' + str(c))
if d == c:
	print('Draw')


import string
word = input().rstrip()
length = len(word)
vowels = {i: False for i in string.ascii_uppercase}
for i in 'AEIOU':
	vowels[i] = True
stuart_points = 0
bob_points = 0
for start in range(length):
	if vowels[word[start]]:
		bob_points += length - start
	else:
		stuart_points += length - start
if stuart_points > bob_points:
	print('Stuart', stuart_points)
elif stuart_points < bob_points:
	print('Kevin', bob_points)
else:
	print('Draw')


word = input()
n = len(word)
(s, k) = (0, 0)
subs = set()
vowels = ('A', 'E', 'I', 'O', 'U')
for start in range(n):
	if word[start] in vowels:
		k += n - start
	else:
		s += n - start
if k > s:
	print('Kevin ' + str(k))
elif s > k:
	print('Stuart ' + str(s))
else:
	print('Draw')


s = input()
players = [['Stuart', 0], ['Kevin', 0]]
vowels = 'AEIOU'
for (i, c) in enumerate(s):
	player = int(c in vowels)
	players[player][1] += len(s) - i
if players[0][1] == players[1][1]:
	print('Draw')
else:
	final = sorted(players, key=lambda x: x[1], reverse=True)
	print(*final[0])


vowels = ['A', 'E', 'I', 'O', 'U']
p1 = 'Stuart '
p1_score = 0
p2 = 'Kevin '
p2_score = 0
word = input()
l = len(word)
for i in range(l):
	if word[i] in vowels:
		p2_score += l - i
	else:
		p1_score += l - i
if p1_score == p2_score:
	print('Draw')
elif p1_score > p2_score:
	print(p1 + str(p1_score))
else:
	print(p2 + str(p2_score))


import sys
vowels = set(['a', 'e', 'i', 'o', 'u'])
s = sys.stdin.readline().strip().lower()
n = len(s)
kevin = 0
stuart = 0
for i in range(n):
	if s[i] in vowels:
		kevin += n - i
	else:
		stuart += n - i
if kevin > stuart:
	print('Kevin %d' % kevin)
elif stuart > kevin:
	print('Stuart %d' % stuart)
else:
	print('Draw')


s = input()
n = len(s)
player1_score = 0
player2_score = 0
for i in range(n):
	if s[i] in 'AEIOU':
		player2_score += n - i
	else:
		player1_score += n - i
if player1_score > player2_score:
	print('Stuart', player1_score)
elif player1_score < player2_score:
	print('Kevin', player2_score)
else:
	print('Draw')


s = input()

def isvowel(c):
	return c in ('A', 'E', 'I', 'O', 'U')
kevin = 0
stuart = 0
for (i, c) in enumerate(s):
	if isvowel(c):
		kevin += len(s) - i
	else:
		stuart += len(s) - i
if kevin > stuart:
	print('Kevin', kevin)
elif stuart > kevin:
	print('Stuart', stuart)
else:
	print('Draw')


S = input().strip()
S_length = len(S)
(player1, player2) = (0, 0)
for i in range(S_length):
	if S[i] in 'AEIOU':
		player1 += S_length - i
	else:
		player2 += S_length - i
if player1 > player2:
	print('Kevin', player1)
elif player1 < player2:
	print('Stuart', player2)
else:
	print('Draw')


string = input()
vowels = 'AEIOU'
p1 = p2 = 0
l = len(string)
for i in range(l):
	if string[i] in vowels:
		p2 += l - i
	else:
		p1 += l - i
if p1 > p2:
	print('Stuart', p1)
elif p2 > p1:
	print('Kevin', p2)
else:
	print('Draw')


s = input()
(n, Kevin, Stuart) = (len(s), 0, 0)
for (i, l) in enumerate(s):
	if l in 'AEIOU':
		Kevin += len(s) - i
	else:
		Stuart += len(s) - i
if Kevin == Stuart:
	print('Draw')
elif Kevin > Stuart:
	print(' '.join(['Kevin', str(Kevin)]))
else:
	print(' '.join(['Stuart', str(Stuart)]))


s = input()
(cnt1, cnt2, i) = (0, 0, len(s))
vowel = set(['A', 'E', 'I', 'O', 'U'])
for x in s:
	if x in vowel:
		cnt2 += i
	else:
		cnt1 += i
	i -= 1
if cnt1 > cnt2:
	print('Stuart ' + str(cnt1))
elif cnt2 > cnt1:
	print('Kevin ' + str(cnt2))
else:
	print('Draw')


s = input()
ls = len(s)
stuart = kevin = 0
vow = 'AEIOU'
for index in range(ls):
	if s[index] in vow:
		kevin += ls - index
	else:
		stuart += ls - index
if stuart > kevin:
	print('Stuart {}'.format(stuart))
elif stuart < kevin:
	print('Kevin {}'.format(kevin))
else:
	print('Draw')


s = input()
l = len(s)
substring = []
x = 0
y = 0
vow = ['A', 'E', 'I', 'O', 'U']
for i in range(len(s)):
	if s[i] in vow:
		y += l - i
	else:
		x += l - i
if x > y:
	print('Stuart', x)
elif x < y:
	print('Kevin', y)
else:
	print('Draw')


S = input()
player1 = 0
player2 = 0
n = len(S)
for i in range(n):
	if S[i] in ['A', 'E', 'I', 'O', 'U']:
		player1 += n - i
	else:
		player2 += n - i
if player1 > player2:
	print('Kevin' + ' ' + str(player1))
elif player2 > player1:
	print('Stuart' + ' ' + str(player2))
else:
	print('Draw')


game = input()
(p1, p2) = (0, 0)
vowels = 'AEIOU'
for i in range(len(game)):
	if game[i] not in vowels:
		p1 += len(game) - i
	else:
		p2 += len(game) - i
if p1 > p2:
	print('Stuart', p1)
elif p1 < p2:
	print('Kevin', p2)
else:
	print('Draw')


s = input()
vowels = list('AEIOU')
last = len(s)
vowelScore = 0
consonantScore = 0
for (i, letter) in enumerate(s):
	if letter in vowels:
		vowelScore += last - i
	else:
		consonantScore += last - i
if vowelScore > consonantScore:
	print('Kevin ' + str(vowelScore))
elif vowelScore < consonantScore:
	print('Stuart ' + str(consonantScore))
else:
	print('Draw')


s = input()
score_stuart = score_kevin = 0
length = len(s)
multiple = length
for i in range(length):
	if s[i] in 'AEIOU':
		score_kevin += 1 * multiple
	else:
		score_stuart += 1 * multiple
	multiple -= 1
if score_stuart > score_kevin:
	print('Stuart', score_stuart)
elif score_stuart < score_kevin:
	print('Kevin', score_kevin)
else:
	print('Draw')


from collections import Counter
string = input()
length = len(string)
(stuart, kevin) = (0, 0)
for (i, c) in enumerate(string):
	if string[i] in ('A', 'E', 'I', 'O', 'U'):
		kevin += length - i
	else:
		stuart += length - i
if stuart > kevin:
	print('Stuart {}'.format(stuart))
elif kevin > stuart:
	print('Kevin {}'.format(kevin))
else:
	print('Draw')


s = input()
x = len(s)
(j, p1, p2) = (0, 0, 0)
v = ['A', 'E', 'I', 'O', 'U']
for i in s:
	if i in v:
		p2 += x - j
	else:
		p1 += x - j
	j += 1
if p1 > p2:
	print('Stuart', p1)
elif p2 > p1:
	print('Kevin', p2)
else:
	print('Draw')


s = input()
n = len(s)
stuart = 0
kevin = 0
for i in range(n):
	if s[i] in ['A', 'E', 'I', 'O', 'U']:
		kevin += n - i
	else:
		stuart += n - i
if stuart > kevin:
	print('Stuart ' + str(stuart))
elif stuart == kevin:
	print('Draw')
else:
	print('Kevin ' + str(kevin))


s = input()
p1 = sum((len(s) - i for (i, c) in enumerate(s) if c not in 'AEIOU'))
p2 = sum((len(s) - i for (i, c) in enumerate(s) if c in 'AEIOU'))
print('Draw') if p1 == p2 else print('Stuart ' + str(p1)) if p1 > p2 else print('Kevin ' + str(p2))


word = input()
stuart_pts = 0
kevin_pts = 0
list_vow = ['A', 'E', 'I', 'O', 'U']
word_list = list(word)
word_length = len(word_list)
for i in range(len(word_list)):
	if word_list[i] in list_vow:
		kevin_pts += word_length - i
	else:
		stuart_pts += word_length - i
if kevin_pts == stuart_pts:
	print('Draw')
else:
	print('Stuart ' + str(stuart_pts) if stuart_pts > kevin_pts else 'Kevin ' + str(kevin_pts))


s = input()
p = list(s)
si = len(s)
sum = 0
add = 0
for i in range(len(s)):
	if p[i] == 'A' or p[i] == 'E' or p[i] == 'I' or (p[i] == 'O') or (p[i] == 'U'):
		sum = sum + si - i
	else:
		add = add + si - i
if sum > add:
	print('Kevin', sum, sep=' ')
elif add > sum:
	print('Stuart', add, sep=' ')
else:
	print('Draw')


s = input()
l = len(s)
consonants = 'BCDFGHJKLMNPQRSTVWXYZ'
vowels = 'AEIOU'
p1Score = sum((l - i for i in range(l) if s[i] in consonants))
p2Score = sum((l - i for i in range(l) if s[i] in vowels))
if p1Score > p2Score:
	print('Stuart ' + str(p1Score))
elif p1Score < p2Score:
	print('Kevin ' + str(p2Score))
else:
	print('Draw')