S<\/em><\/strong>.<\/p>\n\n\n\nStuart has to make words starting with consonants.<\/p>\n\n\n\n
Kevin has to make words starting with vowels.<\/p>\n\n\n\n
The game ends when both players have made all possible substrings.<\/p>\n\n\n\n
Scoring<\/strong><\/p>\n\n\n\nA player gets +1 point for each occurrence of the substring in the string S<\/em><\/strong>.<\/p>\n\n\n\nFor Example<\/strong><\/p>\n\n\n\nString S = BANANA\nKevin's vowel beginning word = ANA\nHere, ANA occurs twice in BANANA. Hence, Kevin will get 2 Points.<\/pre>\n\n\n\nYour task is to determine the winner of the game and their score.<\/p>\n\n\n\n
<\/span>Input Format<\/strong><\/span><\/h2>\n\n\n\nA single line of input containing the string S<\/em><\/strong>.<\/p>\n\n\n\nNote: <\/strong>The string S<\/strong> will contain only uppercase letters: [A – Z]<\/strong>.<\/p>\n\n\n\n<\/span>Constraints<\/strong><\/span><\/h2>\n\n\n\n0 <= len(S) <= 10^6<\/strong><\/p>\n\n\n\n<\/span>Output Format<\/strong><\/span><\/h2>\n\n\n\nPrint one line: the name of the winner and their score separated by a space.
If the game is a draw, print Draw.<\/p>\n\n\n\n
Sample Input<\/strong><\/p>\n\n\n\nBANANA<\/pre>\n\n\n\nSample Output<\/strong><\/p>\n\n\n\nStuart 12<\/pre>\n\n\n\n<\/span>Solution – The Minion Game in Python – Hacker Rank Solution <\/strong><\/span><\/h2>\n\n\n\n<\/span>Python 3 <\/strong><\/span><\/h3>\n\n\n\ndef minion_game(string):\n # your code goes here\n vowel = 'aeiou'.upper()\n strl = len(string)\n kevin = sum(strl-i for i in range(strl) if string[i] in vowel)\n stuart = strl*(strl + 1)\/2 - kevin\n\n if kevin == stuart:\n print ('Draw')\n elif kevin > stuart:\n print ('Kevin %d' % kevin)\n else:\n print ('Stuart %d' % stuart)\nif __name__ == '__main__':\n s = input()\n minion_game(s)<\/pre>\n\n\n\n