
#include <stdio.h>

#include <stdlib.h>

#include <string.h>

#include <math.h>

int main ()

{

int n;

char str[10000];

while ( scanf ("%d", &n) != EOF && n )

{

getchar ();

for ( int i = 0; i < n; i ++ )

{

scanf ("%s", &str);

int len = 0;
while ( str[len] != '\0') //錯點

len ++;

int index = 0;

while ( index < len )

{

int count = 1;

if ( str[index] != str[index + 1] )

{

printf ("%c", str[index]);

index ++;

}

else

{

count ++;
while (str[index] == str[ index + count]) //錯點:是 == 
count ++;

printf ("%d%c", count, str[index]);

index += count;

}

}

printf ("\n");

}

}


return 0;

}

posted on 2010-09-03 11:50
雪黛依夢 閱讀(410)
評論(0) 編輯 收藏 引用 所屬分類:
字符串處理題