#K48662. Longest Contiguous Substring
Longest Contiguous Substring
Longest Contiguous Substring
Given a string s consisting of lowercase English letters, find the length of the longest contiguous substring in which all characters are identical.
In other words, if you denote by \( f(s) \) the length of the longest sequence of consecutive repeating characters in s, your task is to compute \( f(s) \).
Example: For the input "aabbbccaaa", the longest contiguous substring is "bbb" (or "aaa" at the end) with a length of 3.
The input will be provided via standard input, and your solution should print the result to standard output.
inputFormat
The input consists of a single line containing a string s of lowercase English letters. The string may be empty.
outputFormat
Output a single integer representing the length of the longest contiguous substring where all characters are the same.## sample
aabbbccaaa
3