Not Another Constructive!
시간 제한1초메모리 제한2048 MB
길이 n 문자열에서 일부 글자는 고정되어 있고 물음표를 채워 부분수열 NAC의 개수가 정확히 k가 되도록 만들거나, 불가능하면 -1을 출력한다.
문제
Sick of solving geometry problems, you decide to solve the following constructive problem: find a string of length that contains exactly not necessarily contiguous subsequences of NAC.
This problem seems too familiar though. Here's the twist - your friend has given you part of the string, so you must fill in the remaining characters!
입력
The first line of input contains two integers () and (), where is the length of the string and is the number of not necessarily contiguous subsequences of NAC that the output must contain.
The second line contains a string of length exactly , consisting only of uppercase letters and/or question marks.
출력
Output a string of upper case letters, replacing each question mark in the input string with an uppercase letter so that the resulting string has exactly subsequences of NAC. If this is not possible, output -1. Any uppercase letters in the input string must be kept in their position. There may be multiple possible solutions for any given test case; any correct solution will be accepted.