No.2021 Not A but B
タグ : / 解いたユーザー数 185
作問者 :
milkcoffee
/ テスター :
Problem Statement
You are given a string $S$ of length $N$ consisting of A, B. You perform the following operation on $S$ exactly $1$ time.
B.How many strings are possible as the string $S$ after the operation?
Input
$N$ $S$
A, B.Output
Print, as an integer, the number of distinct strings $S$ that are possible as $S$ after the operation.
Sample
Sample 1
Input
4 AABA
Output
3
The following $3$ strings are possible.
BBBA
ABBA
AABB
Sample 2
Input
3 ABB
Output
2
The following $2$ strings are possible.
BBB
ABB
Sample 3
Input
7 ABABABA
Output
4
The following $4$ strings are possible.
BBABABA
ABBBABA
ABABBBA
ABABABB
Sample 4
Input
40 ABBAABABAAABABBAABABAAABAAABBABAAAABBABA
Output
31
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。