#include <stdio.h>
#include <cstring>struct Character
{
char c;
int x;
}str[27];char list[10001];
int main()
{
int n;
scanf("%d", &n);
for(int i = 0; i < 26; i++)
str[i].c = 'A' + i;
//getchar(); //吃掉回车
while(n--)
{
for(int i = 0; i < 26; i++)
str[i].x = 1;
scanf("%s", list);
int k = 1;
if(strlen(list) == 1)
printf("%c", list[0]);
else
for(int i = 0; i <= strlen(list)-1; i++)
{
if(i == strlen(list)-1)
{
if(k >= 2)
printf("%d%c", k, list[i]);
else
printf("%c", list[i]);
}
else if(list[i] == list[i+1])
k++;
else
{
if(k >= 2)
{
printf("%d%c", k, list[i]);
k = 1;
}
else
printf("%c", list[i]);
}
}
printf("\n");
}
return 0;
}
HDU-1020-Encoding(字符串)
猜你喜欢
转载自blog.csdn.net/mch2869253130/article/details/82083921
今日推荐
周排行