| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 (추가 시간 없음) | 2048 MB | 102 | 60 | 55 | 66.265% |
You're given a string consisting of the characters A, B, and C. The string contains the same count of A, B, and C characters.
A string is beautiful if
A, one B, and one C, in any order.For example: ABCCBA is a beautiful string, but ABCAB and CCBAAB are not beautiful.
Given a string, you want to partition it into subsequences (not necessarily contiguous) such that each subsequence is a beautiful string.
For example, for the string ABACBCAACCBB, we can do the following:
AB CA C B ACB A C B
This partitions the string into two subsequences ABCACB and ACBACB, both of which are beautiful strings.
For the given string, find the minimum number of subsequences you can partition it into such that each subsequence is beautiful. It can be proven that there is always at least one such partition for all possible inputs that satisfy the input constraints.
The first line of input contains a string $s$ (3ドル \le |s| \le 3 \cdot 10^5$). $|s|$ is divisible by 3ドル$. $s$ contains an equal number of characters A, B, and C.
Output a single integer, which is the minimum subsequences that $s$ can be partitioned into so each subsequence is a beautiful string.
ABACBCAACCBB
2
ICPC > Regionals > North America > Pacific Northwest Regional > 2023 ICPC Pacific Northwest Region > Division 1 A번
ICPC > Regionals > North America > Pacific Northwest Regional > 2023 ICPC Pacific Northwest Region > Division 2 G번
ICPC > Regionals > North America > South Central USA Regional > 2023 South Central USA Regional Contest > Division 1 A번
ICPC > Regionals > North America > South Central USA Regional > 2023 South Central USA Regional Contest > Division 2 A번
ICPC > Regionals > North America > Mid-Atlantic Regional > 2023 Mid-Atlantic USA Regional Contest > Division 1 A번
ICPC > Regionals > North America > Mid-Atlantic Regional > 2023 Mid-Atlantic USA Regional Contest > Division 2 A번
ICPC > Regionals > North America > Southeast USA Regional > 2023 Southeast USA Regional Programming Contest > Division 1 A번
ICPC > Regionals > North America > Southeast USA Regional > 2023 Southeast USA Regional Programming Contest > Division 2 A번