Advertisement
Guest User

Untitled

a guest
Feb 18th, 2020
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. int main()
  2. {
  3. int counter = 1;
  4.  
  5. char str[100];
  6. cin.getline(str,100);
  7. char prevChar[1];
  8. for (int i=0;i<100;i++)
  9. {
  10. if(str[i]!=' '&&prevChar[0] == ' ')
  11. {
  12. if (isalpha(str[i]))
  13. counter++;
  14. }
  15. prevChar[0] = str[i];
  16. }
  17.  
  18.  
  19.  
  20.  
  21. cout<<counter<<endl;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement