Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<cmath>
- #include<cstring>
- using namespace std;
- int main() {
- int t;
- cin >> t;
- while(t--){
- char chuoi[1000];
- fflush(stdin);
- cin.getline(chuoi, 1000);
- int dodai = strlen(chuoi),i,dem=0;
- if(chuoi[0]!=' '&&chuoi[0]!='\t'){
- dem=1;
- }
- for(i = 0; i<dodai-1; i++){
- if(chuoi[i]==' '||chuoi[i]=='\t'||chuoi[i]=='\n'){
- if(chuoi[i+1]!=' '&&chuoi[i+1]!='\t'&&chuoi[i]!='\n'){
- dem++;
- }
- }
- }
- cout << dem << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement