atcoder#AGC055A. [AGC055A] ABC Identity
[AGC055A] ABC Identity
Score : points
Problem Statement
You are given a string of length , containing exactly letters A
, letters B
, and letters C
.
Let's call a string consisting of letters A
, B
, and C
good, if the following conditions hold:
- The length of is divisible by . Let's denote it by .
- .
- Letters and are different from each other.
Examples of good strings are ABC
, BBAACC
, and AAACCCBBB
.
Find a way to split into at most 6 (not necessarily contiguous) subsequences so that the letters from each subsequence form a good string.
It can be proved that, under the constraints of the problem, it's always possible.
Constraints
- The string contains letters
A
, lettersB
, and lettersC
.
Input
Input is given from Standard Input in the following format:
Output
Output a string of length , containing only digits from to . For every which appears in your string, characters of at positions where you output have to form a good string. If there are multiple possible solutions, printing any of them will be considered correct.
2
ABCCBA
111222
is split into subsequences ABC
and CBA
, and each of them is a good string.
4
AABCBCAACBCB
111211241244
Positions of form a subsequence AABBCC
, positions of form a subsequence CAB
, and positions of form a subsequence ACB
.
All of these strings are good.