开始: 2023-09-17 08:00:00

0917日常周赛

结束: 2023-09-24 00:00:00
当前  2025-01-24 17:40:05  类型: IOI  状态: 已经结束 

P1. First ABC
描述

You are given a string S consisting of AB, and CS is guaranteed to contain all of AB, 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 AB, 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
提示
  • 3N100

  • S is a string of length N consisting of AB, and C.

  • S contains all of AB, and C.


提交

题目参数
时间限制 1 秒
内存限制 128 MB
提交