hdu(No.1020)

 

//#define LOCAL
#include<cstdio>
#include<iostream>
int const MAX_N=10001;
int N,T;
std::pair<int,char> P[MAX_N];
void solve()
{
    char c_now='#',c_next;
    int i=0,sum=0;
    while(true)
    {
        c_next=getchar();        
        if(c_now!=c_next)
        {
            P[i].first=sum;
            P[i].second=c_now;
            
            i++;
            c_now=c_next;
            sum=1;
        }    
        else
        {
            sum++;
        }
        if(c_next>'Z'||c_next<'A') break;
    }
    T++;    
    for(int j=1;j<i;j++)
    {
        if(P[j].first==1)
        {
            printf("%c",P[j].second);
        }
        else
        {
            printf("%d%c",P[j].first,P[j].second);
        }
    }
    printf("\n");
}
int main()
{
#ifdef LOCAL
    freopen("1020.in","r",stdin);
    freopen("1020.out","w",stdout);
#endif    
    scanf("%d",&N);
    T=0;
    getchar();
    while(T<N)
    {
        solve();
    }
    return 0;
}

 

posted @ 2014-05-13 16:57  剑风云  阅读(137)  评论(0编辑  收藏  举报