Score : $900$ points
Takahashi has a lot of peculiar devices. These cylindrical devices receive balls from left and right. Each device is in one of the two states A and B, and for each state, the device operates as follows:
The transition of the state of a device happens momentarily and always completes before it receives another ball.
Takahashi built a contraption by concatenating $N$ of these devices. In this contraption,
The initial state of the $i$-th device from the left is represented by the $i$-th character in a string $S$. From this situation, Takahashi performed the following $K$ times: put a ball into the leftmost device from the left side, then wait until the ball comes out of the contraption from either end. Here, it can be proved that the ball always comes out of the contraption after a finite time. Find the state of each device after $K$ balls are processed.
A
or B
.The input is given from Standard Input in the following format:
$N$ $K$ $S$
Print a string that represents the state of each device after $K$ balls are processed. The string must be $N$ characters long, and the $i$-th character must correspond to the state of the $i$-th device from the left.
5 1 ABAAA
BBAAA
In this input, we put a ball into the leftmost device from the left side, then it is returned from the same place.
5 2 ABAAA
ABBBA
4 123456789 AABB
BABA