Both players are given the same string. S. Both players have to make substrings using the letters of the string S. Stuart has to make words starting with consonants. Kevin has to make words starting...


Computer engineering Cs 102


Both players are given the same string. S.<br>Both players have to make substrings using the letters of the string S.<br>Stuart has to make words starting with consonants.<br>Kevin has to make words starting with vowels.<br>The game ends when both players have made all possible substrings.<br>Scoring<br>A player gets +1 point for each occurrence of the substring in the string S.<br>For Example:<br>String S = BANANA<br>Kevin's vowel beginning word = ANA<br>Here, ANA occurs twice in BANANA. Hence, Kevin will get 2 Points.<br>For better understanding, see the image below:<br>BANANA<br>STUART<br>KEVIN<br>WORDS<br>SCORE<br>WORDS<br>SCORE<br>2.<br>AN<br>2<br>BA<br>ANA<br>2<br>NA<br>ANAN<br>BAN<br>ANANA<br>NAN<br>BANA<br>NANA<br>BANAN<br>BANANA<br>ТОTAL<br>12<br>TOTAL<br>Your task is to determine the winner of the game and their score.<br>Function Description<br>Complete the minion game in the editor below.<br>minion_game has the following parameters:<br>• sring string the string to analyze<br>Prints<br>• tring: the winner's name and score, separated by a space on one line, or Dr aw if there is no winner<br>Input Format<br>A single line of input containing the string S.<br>Note: The string S will contain only uppercase letters: [A – Z].<br>Constraints<br>O len(S) < 10<br>Sample Input<br>BANANA<br>Sample Output<br>Stuart 12<br>

Extracted text: Both players are given the same string. S. Both players have to make substrings using the letters of the string 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 S. For Example: String 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: BANANA STUART KEVIN WORDS SCORE WORDS SCORE 2. AN 2 BA ANA 2 NA ANAN BAN ANANA NAN BANA NANA BANAN BANANA ТОTAL 12 TOTAL 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: • sring string the string to analyze Prints • tring: the winner's name and score, separated by a space on one line, or Dr aw if there is no winner Input Format A single line of input containing the string S. Note: The string S will contain only uppercase letters: [A – Z]. Constraints O len(S) < 10="" sample="" input="" banana="" sample="" output="" stuart="">

Jun 10, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here