Color Wheel (Small)

Repaint a circular string of R, G, B cells K times by a local rule, then report the final count of each color.

Medium5SimulationStringImplementationNo attempts yetTime limit1sMemory limit256 MB

Problem

Jihoon prepared a color wheel for a prize event. The disc is divided into NN equal sectors, and each sector is painted red, green, or blue. The rule of the event is simple. Each participant picks one of red, green, and blue. Jihoon spins the wheel, and everyone whose pick matches the color of the sector the spinner lands on receives a prize.

The disc has NN equal sectors, so if aa of them are red, bb are green, and cc are blue, the probabilities of landing on each color are a/Na/N, b/Nb/N, and c/Nc/N in that order. In other words, if nobody knows which sector carries which color, all three colors are theoretically equally likely.

Jihoon surveyed the picks and found that one of the three colors was chosen far more often than the others. The reason turned out to be that somebody had looked at the wheel in advance and told a few friendly participants which color covered the most sectors. So Jihoon wants to repaint the whole wheel. The repainting works as follows. Every sector changes color at the same time.

Let PP be any sector of the wheel.

  1. If the colors of the sector left of PP, of PP itself, and of the sector right of PP are all the same or all different, paint PP blue.
  2. Otherwise, among the three sectors considered in step 1, two carry color XX and one carries color YY.
  3. If at least one of the three cases below holds, paint PP red. Otherwise paint PP green.

XX is red and YY is green, XX is green and YY is blue, XX is blue and YY is red

The sectors form a circle, so the left and right neighbors are found by stepping one sector around the disc. When N=1N=1, both the left and the right neighbor of PP are PP itself, and when N=2N=2, the two neighbors are the same sector.

Jihoon repainted the wheel once this way. Still uneasy, he repainted it K1K-1 more times by the same method. Find how many sectors carry each color after all KK repaintings.

Input

The first line contains NN and KK, separated by a space.

The second line contains a string of length NN that lists the color of each sector of the wheel in clockwise order. Red is given as R, green as G, and blue as B.

1N10001 \le N \le 1000, 1K10001 \le K \le 1000

Output

Print one line with the number of red sectors, the number of green sectors, and the number of blue sectors after the KK repaintings, in that order, separated by spaces.