View Code of Problem 58

#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
	int count=1,i;//count置为1是提前加上了最后一个单词 
	char a[100];
	gets(a);
	for(i=0;a[i]!='\0';i++){
		if(a[i]!=' '&&a[i+1]==' ')
		count++;
	}
	printf("%d",count);
	return 0;
}

Double click to view unformatted code.


Back to problem 58