标签:
1 #include <cstdio> 2 #include <cmath> 3 #include <cstring> 4 #include <ctime> 5 #include <iostream> 6 #include <algorithm> 7 #include <set> 8 #include <vector> 9 #include <sstream> 10 #include <queue> 11 #include <typeinfo> 12 #include <fstream> 13 #include <map> 14 #include <stack> 15 using namespace std; 16 #define INF 100000 17 typedef long long ll; 18 const int maxn=10010; 19 char s[maxn]; 20 int main() 21 { 22 int n; 23 scanf("%d",&n); 24 while(n--){ 25 scanf("%s",s); 26 int temp=1; 27 for(int i=1;i<=strlen(s);i++){ 28 if(s[i]==s[i-1]) temp++; 29 else{ 30 if(temp==1) printf("%c",s[i-1]); 31 else printf("%d%c",temp,s[i-1]); 32 temp=1; 33 } 34 } 35 printf("\n"); 36 } 37 return 0; 38 }
标签:
原文地址:http://www.cnblogs.com/RRirring/p/4711604.html