fork download
  1. #include<stdio.h>
  2. char a[100000];
  3. main()
  4. {
  5. int t,i;
  6. scanf("%d",&t);
  7. gets(a);
  8. while(t--)
  9. {
  10. int count=0;
  11. gets(a);
  12. for(i=0;a[i]!='\0';i++)
  13. {
  14. if(a[i]==' ')
  15. count++;
  16. }
  17. printf("%d\n",count);
  18. }
  19. }
Success #stdin #stdout 0s 2256KB
stdin
1
Vipin Girlfriend
stdout
1