TheLoner @ 2022-08-18 14:41:25
#include <stdio.h>
int main(){
char ju[40000];
int a=0,i,x='0',y=0,p=0,sum;
for (i=0;;i++){
scanf("%c",&ju[i]);
if (ju[i]!='\n'){
a++;
}else{
break;
}
}
sum=a*(a+1)-1;
for (i=a;i<sum;i++){
scanf("%c",&ju[i]);
}
printf("%d ",a);
for (i=0;i<sum;i++){
if(ju[i]==x){
y++;
}else if(ju[i]=='\n'||ju[i]=='\r'){
}else{
printf("%d",y);
if(i<sum-1){
printf(" ");
}
y=0;
x=ju[i];
i--;
}
}
return 0;
}
by TheLoner @ 2022-08-19 16:12:17
求大佬解惑
by zzx_Anthony @ 2022-08-21 15:58:33
可以开成二维的先全部读入再处理