CSES Problemset/Introductory Problems
Repetitions
#1069Ask AI
Open a hint-first prompt in a new AI chat. Grok may ask you to confirm before sending.
Open Claude DesktopYou 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 characters.
Output
Print one integer: the length of the longest repetition.
Constraints
Sample Test Cases (1)
Example 1ID: sample-1
Input
ATTCGGGA
Expected Output
3
Tools
1
2
3
4
5
6
7
8
9
10
11
12
Draft saved locally
|1 line, 0 charsTest Bench
Input (stdin)
ATTCGGGA
Expected Output
3