#CCBCHMOT0000036. Đoạn lặp DNA dài nhất (Repetitions)
Đoạn lặp DNA dài nhất (Repetitions)
Repetitions
Source: CSES
Version: Phuoc Hung OJ Extended
Problem Statement
Given a DNA sequence consisting only of A, C, G, T, find the length of its longest contiguous run of one identical character. Characters cannot be selected from disjoint positions.
Input
One nonempty DNA string containing no whitespace.
Output
Print one integer: the longest identical-character run.
Subtasks
- Subtask 1 (20%): .
- Subtask 2 (30%): .
- Subtask 3 (50%): .
Examples
Example 1
Input
ATTCGGGA
Output
3
Explanation
The runs A, TT, C, GGG, A have lengths 1,2,1,3,1; maximum is 3.
Example 2
Input
AAAA
Output
4
Explanation
All four A characters form one run of length four.