Guest User

Untitled

a guest
Jul 20th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. #include<iostream>
  2. #include<cctype>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. string s;
  8. while( getline( cin, s ) )
  9. {
  10. int num = 0;
  11. bool word = 0;
  12. for( int i = 0 ; i < s.length(); i++ )
  13. {
  14. if( isalpha( s[i] ) )
  15. {
  16. if( !word )
  17. {
  18. word = 1;
  19. num++;
  20. }
  21. }
  22. else
  23. word = 0;
  24. }
  25. cout << num << endl;
  26. }
  27. return 0;
  28. }
Add Comment
Please, Sign In to add comment