cao_20115 @ 2024-05-16 23:00:44
#include <cstdio>
#include <cmath>
int a[1000];
int cnt_a;
char c, c1;
int n;
int main(){
while (scanf("%c", &c) != EOF) {
n++;
if (c == c1) {
a[cnt_a]++;
} else {
a[cnt_a++]++;
c1 = c;
}
}
printf("%d", sqrt(n));
for (int i = 0; i < cnt_a; ++i) {
printf(" %d", a[i]);
}
return 0;
}
by lyw_lsy_yhx @ 2024-06-16 11:08:04
你可以试试c++的
by Yaoshui_lv @ 2024-07-04 10:30:38
过了吗?