http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2886
#include <stdio.h>
#include <string.h>
#define M 11000
int main()
{
int t,n,s,i,j,k,c;
char str[M];
scanf("%d",&t);
while(t--)
{
scanf("%s",str);
i=0;c=1;
while(str[i])
{
if(str[i]!=str[i+1])
{
printf("%d%c",c,str[i]);
c=1;
}
else
{
c++;
}
i++;
}
printf("\n");
}
return 0;
}