#include
#include
#include
char str[1000];
int* change(char *str)
{
int n,i,j;
int *number;
n = i = j = 0;
while (str[i])
{
for (; str[i] && str[i] == ' '; ++i); //找到数字的第一位
for (j = i + 1; str[j] && str[j] != ' '; ++j); //找到数字的后一位
i = j;
++n;
}
number = (int*) malloc( sizeof(int) * (n+1) );
//上面这一段用来分析一共有多少个数,以此分配空间
n = i = j = 0;
while (str[i])
{
for (; str[i] && str[i] == ' '; ++i);
for (j = i + 1; str[j] && str[j] != ' '; ++j);
number[++n] = atoi(str + i);
i = j;
}
number[0] = n;
return number;
}
int main()
{
gets(str);
int *p = change(str);
printf("%d\n", p[0]);
for (int i = 1; i <= p[0]; ++i) printf("%d\n", p[i]);
system("pause");
free(p);
}