Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main()
- {
- int n;
- string str;
- cin >> n;
- while(n--) {
- getline(cin, str);
- int count = str.size();
- for(int i = 0; i < str.size(); i++) {
- if(str[i] == ' ')
- count--;
- }
- cout << count << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment