Problems > Longest Run of One Letter

Longest Run of One Letter

Difficulty: 900 2000 ms 128 MB

strings

Find the length of the longest block of consecutive equal characters.

Input: one line with the string S.

Output: the maximum run length.

Constraints:

  • 1 ≤ |S| ≤ 104
  • S contains lowercase English letters

Sample Tests

Input 1
aabbbcc
Output 1
3
Input 2
abc
Output 2
1

Read the Editorial

Discussion (opens after you solve — no spoilers before)

No comments yet.

Submit Your Solution

Log in or create a free account to run and submit code.