
统计单词
Time Limit: 3000/1000MS (Java/Others) Memory Limit: 65535/65535KB (Java/Others)

C-sources:
#include <stdio.h>
#include <string.h>
#define N 100
int main()
{
int n,i,p,q,j,k,wordnum;
char ch,temp; printf("Please input a n number:\n");
scanf("%d%c",&n,&temp); char **str=new char *[n];
for(i=;i<n;i++)
str[i]=new char[N]; printf("Please input n strings:\n");
for(p=;p<n;p++)
{
q=;
while((ch=getchar())!='\n')
{
str[p][q]=ch;
q++;
}
} for(j=;j<n;j++)
{
k=;
wordnum=;
while(str[j][k]!='\0')
{
if(str[j][k]==' ')
wordnum++;
k++;
}
printf("%d\n",++wordnum);
} return ;
}