#C8101. Longest Repeated Character Substring

    ID: 52047 Type: Default 1000ms 256MiB

Longest Repeated Character Substring

Longest Repeated Character Substring

Given a string s consisting of lowercase English letters, your task is to determine the length of the longest contiguous substring where all characters are the same. Formally, if we denote a substring by s[i...j] (with 0 ≤ i ≤ j < |s|) and each character in the substring is equal, find the maximum length L among all such substrings.

If the input string is empty, output 0.

The problem can be described by the following formula in \( \LaTeX \):

\[ L = \max_{1 \leq k \leq n} \{ \text{length of } s[i..j] \mid s[i] = s[i+1] = \cdots = s[j] \} \]

inputFormat

The input consists of a single line containing a non-negative string s of lowercase English letters. The string can be empty.

outputFormat

Output a single integer which is the length of the longest contiguous substring composed of the same character.

## sample
aaabbccccd
4