CSES - Repetitions | Lặp lại

View as PDF



Authors:
Problem types
Points: 800 (p) Time limit: 1.0s Memory limit: 512M Input: stdin Output: stdout

You are given a DNA sequence: a string consisting of characters A, C, G, and T. Your task is to find the longest repetition in the sequence. This is a maximum-length substring containing only one type of character.

Input

  • The only input line contains a string of \(n\) characters.

Output

  • Print one integer: the length of the longest repetition.

Constraints

  • ~1 \le n \le 10^6~

Example

Sample input

ATTCGGGA

Sample output
3


Comments (10)

Most recent
Loading comments...