ABC Legacy
시간 제한1초메모리 제한1024 MB
길이 2n인 문자열을 AB, AC, BC 중 하나를 이루는 n개의 서로 겹치지 않는 증가하는 인덱스 쌍으로 나눌 수 있는지 판정하고 구성한다.
문제
You are given a string of length , consisting of the characters A, B and C. Determine if can be split into non-intersecting subsequences, each of which forms one of the strings "AB", "AC", "BC". If it is possible, find such a splitting.
입력
The first line of input contains one integer ().
The second line of input contains a string of length , consisting of the characters A, B and C.
출력
If the splitting is not possible, print "NO" (without quotes).
If the splitting is possible, print "YES" (without quotes), followed by lines, each describing two indices for the -th subsequence ().