ShafiulAzim

7.cpp

Jan 25th, 2020
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. int n;
  6. string str;
  7. cin >> n;
  8.  
  9. while(n--) {
  10.  
  11. getline(cin, str);
  12. int count = str.size();
  13. for(int i = 0; i < str.size(); i++) {
  14.  
  15. if(str[i] == ' ')
  16. count--;
  17. }
  18.  
  19. cout << count << endl;
  20. }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment