int fun(char* s)
{
int count = 0;
int i = 0;
for (i = 0; *(s + i); i++)
{
if (*(s + i) == ' ')
{
count++;
}
}
return count;
}
int main()
{
char str[20];
gets(str);
printf("%d", fun(str));
return 0;
}
int fun(char* s)
{
int count = 0;
while (*s)
{
if (*s == ' ')
{
count++;
}
s++;
}
return count;
}