P10368 "LAOI-4" Colors
Background
Do this problem:

Description
Given a string $A$ of length $n$.
- If $A_{i-1}=A_{i+1}$, then $A_i$ is called "erasable".
Define one operation as: erase all "erasable" characters in $A$.
Please output $A$ after performing the operation $k$ times.
Input Format
The first line contains two positive integers $T,id$, representing the number of test cases and the subtask ID.
For each test case, the first line contains a positive integer $n$ and an integer $k$.
The next line contains a string of length $n$.
Output Format
For each test case, output one line with a string representing the answer.
Explanation/Hint
Explanation of the samples:
- For the $1$-st test case, the string is $\text{aba}$, and after one operation it becomes $\text{aa}$.
- For the $2$-nd test case, the string is $\text{acaca}$, and after one operation it becomes $\text{aa}$, and after two operations it becomes $\text{aa}$.
- For the $3$-rd test case, the string is $\text{abc}$, and after zero operations it is $\text{abc}$.
**"This problem uses bundled testdata."**
| $\text{Subtask}$ | $\sum n \le$ | Special Property | Subtask Dependency | Total Score |
| :--------------: | :----------: | :--------------: | :----------------: | :---------: |
| $1$ | $10^6$ | $\text{A}$ | None | $5$ |
| $2$ | $300$ | $k\le 300$ | None | $10$ |
| $3$ | $10^3$ | None | $2$ | $15$ |
| $4$ | $10^6$ | $\text{B}$ | None | $10$ |
| $5$ | $10^6$ | $\text{C}$ | $4$ | $20$ |
| $6$ | $10^7$ | None | $1\sim5$ | $40$ |
For $100\%$ of the testdata, $1 \le \sum n \le 10^7$, $1 \le T \le 10^5$, $0\le k\le 10^{18}$, and the strings consist of lowercase letters.
Special property $\text{A}$: $A$ is a permutation of $\text{a}\sim\text{z}$.
Special property $\text{B}$: $\forall i\in[1,n-2], A_i= A_{i+2}$.
Special property $\text{C}$: It is guaranteed that each $A_i$ can only take two possible values.
Translated by ChatGPT 5