6678.Repetitions

Time Limit: 1s Memory Limit: 512MB

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 Format(From the terminal/stdin)

The only input line contains a string of $n$ characters.

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

Output Format(To the terminal/stdout)

Print one integer: the length of the longest repetition.

Sample Input

Copy
ATTCGGGA
        \n

Sample Output

Copy
3
 \n
Source: CSES, Introductory Problems, 1069

Submit

请先 登录

© 2025 FAQs