No.1943 The Vanishing AGCT (1)
Problem Statement
A string $s$ of $n$ characters consisting only of uppercase English letters is given as input.
You perform operations so that $s$ satisfies the condition. Output the minimum number of operations required.
Condition: $s$ does not contain any of the characters A,G,C,T
One operation consists of carrying out the following steps 1. through 3. in order. The steps cannot be reordered, and no step can be skipped.
Operation:
- Let $c$ be the total number of characters
A,G,C,Tcontained in $s$ - Let $t$ be the string obtained by deleting the $c$-th character of $s$
- Replace $s$ with $t$
Input
$n$ $s$
Constraints
- $ 1 \le n \le 5 \times 10^{5}$
- $|s|=n$
- $s$ consists only of uppercase English letters
- $n$ is an integer
Output
Output the minimum number of operations required until the condition is satisfied.
Print a newline at the end.
Sample
Sample 1
Input
6 ABCDEF
Output
3
The string changes as ABCDEF→ACDEF→ADEF→DEF.
Sample 2
Input
9 YUKICODER
Output
5
Sample 3
Input
19 ATCODERGRANDCONTEST
Output
19
Sample 4
Input
3 XYZ
Output
0
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
H20
蜜蜂
naskya