Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- int main(){
- char s[50],ch;
- int i,c=0,len;
- while ( gets(s) ){
- len = strlen(s);
- if ( len == 0 ) break;
- c=0;
- for(i=0; s[i]!='\0' ; i++ ){
- if(s[i]==' '){
- c++;
- while(s[i]==' ')
- i++;
- }
- }
- printf("%d\n",c+1);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement