SP24730 BLCATS - Magical colorful cats (hard)
Description
There is a circle with n cats, includes white cats, red cats and green cats. When two cats with different color talk with each other, they both change to third color. If they are same color, nothing will happen.
At each step, the 1 $ ^{st} $ cat talks with 2 $ ^{nd} $ cat, the 2 $ ^{nd} $ cat talks with the 3 $ ^{rd} $ cat,… and the n $ ^{th} $ cat talks with 1 $ ^{st} $ cat.
Given the original color of n cats, your task is find the color of n cats after k steps.
Input Format
\- First line : n and k (1
\- Second line : n characters, the i-th charater denotes color of the i-th cat at first state
Output Format
\- n charaters denotes the color of n cats after k steps.