[ABC421C] 相间字符串 (Alternated)
Problem Statement
You are given a string of length . contains exactly occurrences of A and occurrences of B.
Find the minimum number of operations (possibly zero) needed to make have no adjacent identical characters, where an operation consists of swapping two adjacent characters in .
Input
The input is given from Standard Input in the following format:
$N$
$S$
Output
Print the answer.
Example
3
AABBBA
2
Note
-
Constraints:
-
-
is an integer.
-
is a string of length consisting of occurrences of
Aand occurrences ofB. -
Source: ABC421C