#K57397. Longest Repeated Substring
Longest Repeated Substring
Longest Repeated Substring
Given a string \(s\), your task is to determine the length of the longest contiguous substring that consists of the same character. For example, if \(s = \texttt{aaabbbaaa}\), the longest substring is \(aaa\) with a length of 3. If the string is empty, return 0.
Note: The input is provided via standard input (stdin) and the output should be printed to standard output (stdout).
inputFormat
A single line containing the string (s). The string may contain any characters and can be empty.
outputFormat
A single integer representing the length of the longest contiguous substring with all characters the same.## sample
aaabbbaaa
3