hhhh3h1 @ 2024-09-09 15:14:31
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string.h>
int main(void)
{
char str[200], arr[40001];
scanf("%s", str);
int N = strlen(str);
strcat(arr, str);
for (int i = 1; i < N; i++)
{
scanf("%s", str);
strcat(arr, str);
}
printf("%d\t", N);
int num = 0;
int sum = 0;
int m = strlen(arr);
printf("%d\n", m);
for (int i = 0; i <= m; i++)
{
if (arr[i] == num)
{
sum++;
}
else
{
printf("%d\t", sum);
num = arr[i];
sum = 1;
}
}
return 0;
}
by hhhh3h1 @ 2024-09-09 15:15:07
第一个循环输入的地方