1
+
2
+ # Kevin and Stuart want to play the 'The Minion Game'.
3
+
4
+ # Game Rules
5
+
6
+ # Both players are given the same string, .
7
+ # Both players have to make substrings using the letters of the string .
8
+ # Stuart has to make words starting with consonants.
9
+ # Kevin has to make words starting with vowels.
10
+ # The game ends when both players have made all possible substrings.
11
+
12
+ # Scoring
13
+ # A player gets +1 point for each occurrence of the substring in the string .
14
+
15
+ # For Example:
16
+ # String = BANANA
17
+ # Kevin's vowel beginning word = ANA
18
+ # Here, ANA occurs twice in BANANA. Hence, Kevin will get 2 Points.
19
+
20
+ # For better understanding, see the image below:
21
+
22
+ # banana.png
23
+
24
+ # Your task is to determine the winner of the game and their score.
25
+
26
+ # Input Format
27
+
28
+ # A single line of input containing the string .
29
+ # Note: The string will contain only uppercase letters: .
30
+
31
+ # Constraints
32
+
33
+
34
+
35
+ # Output Format
36
+
37
+ # Print one line: the name of the winner and their score separated by a space.
38
+
39
+ # If the game is a draw, print Draw.
40
+
41
+ # Sample Input
42
+
43
+ # BANANA
44
+ # Sample Output
45
+
46
+ # Stuart 12
47
+ # Note :
48
+ # Vowels are only defined as . In this problem, is not considered a vowel.
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+ def minion_game (string ):
57
+ s = string
58
+
59
+ vowels = 'AEIOU'
60
+
61
+ kevsc = 0
62
+ stusc = 0
63
+ for i in range (len (s )):
64
+ if s [i ] in vowels :
65
+ kevsc += (len (s )- i )
66
+ else :
67
+ stusc += (len (s )- i )
68
+
69
+ if kevsc > stusc :
70
+ print "Kevin" , kevsc
71
+ elif kevsc < stusc :
72
+ print "Stuart" , stusc
73
+ else :
74
+ print "Draw"
75
+
76
+ if __name__ == '__main__' :
77
+ s = raw_input ()
78
+ minion_game (s )
79
+
80
+
81
+
82
+
83
+
84
+
85
+
86
+
87
+
88
+
89
+
90
+ # MY Code
91
+ # s = input()
92
+ # kevin = []
93
+ # stuard = []
94
+
95
+ # subk = []
96
+ # subs = []
97
+
98
+
99
+ # for i in range(len(s)):
100
+ # if(s[i]=="A" or s[i]=="E" or s[i]=="I" or s[i]=="O" or s[i]=="U"):
101
+ # kevin.append(s[i])
102
+ # else:
103
+ # stuard.append(s[i])
104
+
105
+ # print(kevin)
106
+ # print(stuard)
107
+
108
+ # for i in range(0,len(s)):
109
+ # for j in range(0,len(s)):
110
+ # if j ==len(s):
111
+ # break
112
+ # elif s[i] in kevin:
113
+ # subk.append(s[i:j])
114
+ # elif s[i] in stuard:
115
+ # subs.append(s[i:j])
116
+
117
+ # print(subk)
118
+ # print(subs)
0 commit comments