TonyTroev

First exercise

Nov 13th, 2018
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. int main(){
  6. string x;
  7. getline(cin, x);
  8.  
  9. int count = 1;
  10.  
  11. for (const char &symbol : x) {
  12. if (isspace(symbol))
  13. count++;
  14. }
  15.  
  16. cout << count << endl;
  17.  
  18. return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment