← 返回 netflix 的题目列表Longest Run of Identical Characters
类型:online_judge
Given a non-empty string s, return the length of the longest contiguous substring consisting of the same character.
A substring must occupy consecutive positions in the original string.
Example 1:
Input: s = "leetcode"
Output: 2
Explanation: "ee" is the longest run of identical characters.
Example 2:
Input: s = "abbcccddddeeeeedcba"
Output: 5
Explanation: The run "eeeee" has length 5.
Constraints:
1 <= len(s) <= 10^5
s consists of comparable characters.
Example
Input
leetcode
Output
2