#include <bits/stdc++.h>
using namespace std;
const int maxn = 55;
char str[maxn];
int main()
{
int len;
scanf("%d",&len);
while(len--)
{
int j = 0;
cin >> str;
for(int i = 0;str[i]!='\0';i++)
{
str[j++] = str[i];
if(j >= 3 && str[j-3]==str[j-2] && str[j-2] == str[j-1])
j--;
if(j >= 4 && str[j-4]==str[j-3] && str[j-2] == str[j-1])
j--;
}
str[j] = '\0';
cout << str << endl;
}
}
字节跳动机试 聪明的编辑
最新推荐文章于 2024-08-08 15:12:59 发布