fork(1) download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main(void)
  5. {
  6. char * str = (char*)malloc(sizeof(char)*1000001);
  7. int i=0, count = 0;
  8. fgets(str, 1000001, stdin);
  9. while(str[i]!='\n')
  10. {
  11. if(str[i]==' ')
  12. count++;
  13. i++;
  14. }
  15. if(str[0]==' ') count--;
  16. if(str[i-1]==' ') count--;
  17. printf("%d", ++count);
  18. return 0;
  19. }
Runtime error #stdin #stdout 0s 4328KB
stdin
The Curious Case of Benjamin Button
stdout
Standard output is empty