#K90472. Longest Single-Character Substring
Longest Single-Character Substring
Longest Single-Character Substring
You are 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. In other words, find the maximum length of any substring which contains only one distinct character.
Example:
Input: abbcccddddeeeee Output: 5
Here, the longest substring is "eeeee" with a length of 5. If the string is empty, the output should be 0.
inputFormat
The input consists of a single line containing the string s
(which may be empty). The string only contains lowercase English letters.
outputFormat
Print an integer representing the length of the longest contiguous substring containing only one distinct character.
## sampleabbcccddddeeeee
5