OncleChen @ 2022-11-01 11:57:04
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
int main()
{
char ch_temp[201];
int i_temp = 0;
while (1)
{
ch_temp[i_temp] = getchar();
if (isspace(ch_temp[i_temp])) break;
i_temp++;
}
int n = i_temp++;
int* arr = (int*)calloc(n * n, sizeof(int));
for (int i = 0; i < n; i++)
arr[i] = (int)ch_temp[i] - 48;
for (int i = n; i < n * n; i++)
{
char c = getchar();
if (isspace(c)) c = getchar();
arr[i] = (int)c - 48;
}
printf("%c ", (char)n + 48);
int res = 0, sum = 1;
if (0 != arr[0]) printf("%c ", '0');
for (int i = 0; i < n * n; i++)
{
if (arr[i] == arr[i + 1]) sum++;
else
{
printf("%c ", (char)sum + 48);
sum = 1;
}
}
free(arr);
return 0;
}