Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdio>
- #include<string.h>
- #include<algorithm>
- #include<vector>
- #include<functional>
- using namespace std;
- char C[1000010];
- int num = 0, n;
- int main(void) {
- cin.getline(C,1000010);
- n = strlen(C);
- for (int i = 0; i < n; i++) {
- if (C[i] == ' '&& i == 0) {
- }
- else if (C[i] == ' '&& i == n - 1) {
- }
- else if (C[i] == ' ') {
- num++;
- }
- }
- if(n!=1 && n!=0 ) num++;
- cout << num;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement