Question: python programming MEDIUM-1 Rohan plays basketball and is part of a league. His team has several matches scheduled. At the beginning of the league, Rohan's


python programming
MEDIUM-1 Rohan plays basketball and is part of a league. His team has several matches scheduled. At the beginning of the league, Rohan's coach told him to write down the match number of every match that their team wins. Rohan followed his coach's instructions but might have written down some match numbers more than once and in random order. One day, Rohan's coach asked him to find out the longest winning streak of their team from the match numbers Rohan wrote down. Your task is to help Rohan find the longest winning streak of his team. Given space-separated numbers representing the match numbers that Rohan noted, write a program to find the longest winning streak of Rohan's team. If there is no winning streak, print 1. Winning Streak refers to the number of consecutive matches won. The longest winning streak refers to the maximum of the winning streaks. Example: If the match numbers noted are 852931 4 , - The winning streaks are 5(1,2,3,4,5) and 2 The input will be a single line containing space-separated integers representing inatch numbers. Output The output should be a single line containing an integer representing the longest winning streak. Explanation For example, if the given space-separated match numbers are 14 31327151251466 , - Winning streaks in 1,4,3,13,2,7,15,12,5,14,6 are 7(1,2, 3,4,5,6,7) and 4(12,13,14,15). - The longest winning streak is 7 as 7 is maximum among 7 and 4. The output should be 7. Sample Input 1 1431327151251466 Sample Output 1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
