#K46962. Longest Consecutive Heads Sequence
Longest Consecutive Heads Sequence
Longest Consecutive Heads Sequence
You are given a string consisting solely of the characters H
and T
. The character H
represents a head, while T
represents a tail. Your task is to determine the length of the longest contiguous sequence of H
in the string.
Example:
Input: HHTTHTHH Output: 2
The solution should handle the input by reading from standard input (stdin) and output the result to standard output (stdout).
inputFormat
The input consists of a single line containing a string composed only of the characters H
and T
.
outputFormat
Output a single integer representing the length of the longest contiguous sequence of H
in the given string.
HHTTHTHH
2