T422088 「LAOI-4」Colors
/*
手玩数据,会发现,你找不出可以进行超过两次操作的字符串,大胆假设,加上题目里怪异的k <= 10^18,把k限制在2以内
就没了
*/
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
typedef long long LL;
int n, len;
LL m;
string s;
string make(string s1)
{
string s2;
int len = s1.size();
for (int i = 0; i < len; i ++ )
{
if (i == 0 || i == len - 1) s2 += s1[i];
else if (s[i - 1] != s[i + 1]) s2 += s1[i];
}
return s2;
}
int main()
{
int T, l;
cin >> T >> l;
while (T -- )
{
cin >> n >> m;
cin >> s;
len = s.size();
if (m > 2) m = 2;
while (m -- ) s = make(s);
cout << s << endl;
}
return 0;
}