MUTDNA - DNA

题意翻译

# 题目描述: 我们发现了一种新型 $DNA$ ,这种 $DNA$ 只由 $N$ 个字母 $A$ 构成,在一次辐射中这种 $dna$ 变成了由总共 $N$ 个字母 $A$ 和 $B$ 构成,在辐射中只会发生两种异变: 1.将某个任意位置字母反转 ,例如:将第 $K$ 位置的 $A$ 变为 $B$ ,或将 $B$ 变为 $A$ . 2.将 $1$ 到 $K$ 位置上的所有字母反转, $1≤K≤N$ 并且 $K$ 可以任选. 请你计算将全 $A$ 序列转化为最终序列需要最少多少次异变.每发生一个 $1$ 异变或 $2$ 异变都计入一次总异变数. # 输入格式: 第一行包含正整数 $N(1≤N≤1 000 000)$ ,代表 $DNA$ 的长度. 第二行输入包含一个有 $N$ 个字符的字符串,每个字符都是 $A$ 或 $B$ . # 输出格式: 一行一个数字代表最小的异变数. 感谢@不许雷同 提供的翻译

题目描述

Biologists have discovered a strange DNA molecule, best described as a sequence of N characters from

输入输出格式

输入格式


The first line of input contains the positive integer N (1 The second line of input contains a string with N characters, with each character being either A or B. This string represents the starting state of the molecule.

输出格式


The first and only line of output must contain the required minimum number of mutations.

输入输出样例

输入样例 #1

1:
4
ABBA

输出样例 #1

1:
2