spoj#COLORCAT. Magical colorful cats (easy)

Magical colorful cats (easy)

本题没有可用的提交语言。

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 1st cat talks with 2nd cat, the 2nd cat talks with the 3rd cat,… and the nth cat talks with 1st cat.

Given the original color of n cats, your task is find the color of n cats after k steps.

Input :

-       First line : n and k (1 ≤ n ≤ 20000, 1 ≤ k ≤ 30000)

-       Second line : n characters, the i-th charater denotes color of the i-th cat at first state

Output :

-       n charaters denotes the color of n cats after k steps.

Sample :

Input :

            3 1

            GRR

Output :

            RGR

Input :

            5 4

            WRWRW

Output :

            GGGWG

 

Note : After solved this problem, you may want to try BLCATS