#P7767. [COCI 2011/2012 #5] DNA
[COCI 2011/2012 #5] DNA
Description
There is a sequence of length consisting of the letters and .
Each operation can be one of the following two types:
-
Change one character in the sequence ( or ).
-
Change a prefix of the sequence, i.e. perform operation 1 on characters through .
Find the minimum number of operations needed to make the entire sequence all .
Input Format
The first line contains an integer .
The second line contains characters, representing the sequence.
Output Format
Output one line containing one integer, representing the answer.
4
ABBA
2
5
BBABB
2
12
AAABBBAAABBB
4
Hint
.
The sequence consists only of 'A' and 'B'.
Translated from COCI 2011/2012 #5 T3.
Translated by ChatGPT 5
京公网安备 11011102002149号