#K49292. Winning Streak Detection
Winning Streak Detection
Winning Streak Detection
In this problem, you are given a string representing the outcomes of a series of matches in a tournament. Each character in the string is either W
(indicating a win) or L
(indicating a loss). Your task is to determine if there exists a winning streak of at least three consecutive wins.
If the string contains three or more consecutive W
characters, output "Winning streak detected!"; otherwise, output "No winning streak."
The check can be viewed mathematically as verifying if there exists an index \(i\) such that:
[ S[i]==W,\quad S[i+1]==W,\quad S[i+2]==W ]
where \(S\) is the outcomes string.
inputFormat
The input consists of a single line containing a non-empty string made up of characters W
and L
, which represent the outcomes of the matches.
outputFormat
Output a single line containing the string "Winning streak detected!" if there is any occurrence of three consecutive wins; otherwise, output "No winning streak."
## sampleWWLWWWLW
Winning streak detected!