#K37362. Max Consecutive High Sales Days
Max Consecutive High Sales Days
Max Consecutive High Sales Days
You are given a string S
consisting of characters 'H' and 'L', where 'H' indicates a high sales day and 'L' indicates a low sales day. Your task is to compute the maximum number of consecutive high sales days.
For example, if S = "HHLLH"
, then the maximum consecutive high sales days is 2. In mathematical terms, if we define f(S) as:
you need to compute f(S).
inputFormat
The input consists of a single line containing a string S
composed only of the characters 'H' and 'L'.
Constraints:
1 \leq |S| \leq 10^5
, where|S|
denotes the length of the string.
outputFormat
Output a single integer representing the maximum number of consecutive 'H' characters in S
.
HHLLH
2