HDU 1020
#include <iostream> #include <cstring> using namespace std; const int N = 10000; int main(){ int T,len,i,j,cnt; char str[N]; cin>>T; while(T--){ cnt=1; cin>>str; len=strlen(str); for(i=0;i<len;i++){ while(str[i]==str[i+1]){ cnt++; i++; } if(cnt==1) cout<<str[i]; else{ cout<<cnt<<str[i]; cnt=1; } } cout<<endl; } return 0; }