http://acm.hdu.edu.cn/showproblem.php?pid=1020
#include <iostream>
#include <cstring>
using namespace std;
void f(char *a,int len)
{
int i = 0;
int j,cnt = 1;
char temp;
while(i < len)
{
temp = a[i];
while(temp == a[i+1])
{
cnt++;
i++;
}
i++;
if (cnt != 1)
{
cout << cnt;
}
cout << temp ;
cnt = 1;
}
}
int main()
{
int n;
cin >> n;
char a[10100];
while(n--)
{
cin >> a;
f(a,strlen(a));
cout << endl;
}
return 0;
}