You are given a string �S consisting of A
, B
, and C
. �S is guaranteed to contain all of A
, B
, and C
.
If the characters of �S are checked one by one from the left, how many characters will have been checked when the following condition is satisfied for the first time?
All of A
, B
, and C
have appeared at least once.
The input is given from Standard Input in the following format:
N
S
Print the answer.
5 ACABB
4
4 CABC
3
30 AABABBBABABBABABCABACAABCBACCA
17
3≤N≤100
�S is a string of length �N consisting of A
, B
, and C
.
�S contains all of A
, B
, and C
.
时间限制 | 1 秒 |
内存限制 | 128 MB |