We are given the results of a tennis match between two players A and B as a string.
For eg- "ababbabaa", Here the ith character is 'a' then it represents that the ith game is won by a.
A set is a positive integer. A set is won by a player if he wins (set value) games first. We have to find out all the possible valid sets that are possible for the string and output the outcome of the match (The one who wins more sets wins the match).
For eg — if Set size = 3
, ababb | abaa
, Resuts in a draw.
if Set size = 2
, aba | bb | aba | a
, Which is not a valid Match so set = 2 is not possible.