#K93732. Longest Consecutive Character Sequence

    ID: 38485 Type: Default 1000ms 256MiB

Longest Consecutive Character Sequence

Longest Consecutive Character Sequence

Given a string ( s ), your task is to determine the length of the longest consecutive sequence of repeated characters within ( s ). For instance, if ( s = "aaabbcca" ), the longest sequence is ( "aaa" ) and its length is 3. Note that the string may be empty, in which case the answer is 0.

Implement a solution that reads the input from standard input (stdin) and outputs the result to standard output (stdout).

inputFormat

The input consists of a single line containing the string ( s ). The string can include any characters and may be empty.

outputFormat

Output a single integer, which is the length of the longest consecutive sequence of repeated characters found in ( s ).## sample

aaabbcca
3

</p>