hdu1020

#include <stdio.h>

int main(void)
{
int n,i,c;
char txt[10001];
scanf("%d", &n);
while(n--)
{
scanf("%s",txt);
i=0;
while(txt[i++])
{
c=1;
while(txt[i]==txt[i-1])
{
i++;
c++;
}
if(c>1)printf("%d%c",c,txt[i-1]);
else printf("%c",txt[i-1]);
}
printf(" ");
}

return 0;
}

原文地址:https://www.cnblogs.com/wangkun1993/p/6275682.html