fork(1) download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. char s[101];
  7. int nr,i;
  8. cin.getline(s,101);
  9. if(s[0]!=' ')
  10. nr=1;
  11. else
  12. nr=0;
  13. for(i=0; i<strlen(s); i++)
  14. if(s[i]==' ' and s[i+1]!=' ')
  15. nr++;
  16. cout<<nr;
  17. }
Success #stdin #stdout 0s 4256KB
stdin
    Ioana          castiga   acest joc
stdout
4