Untitled

 avatar
unknown
plain_text
a month ago
759 B
13
Indexable
#include <bits/stdc++.h>

using namespace std;

void De_lesseps() {
    int cnt{};
    string s;
    while (cin >> s) {
        for (int i = 0;i<s.size();i++)
            if (s[i] == '?' || s[i] == '.' || s[i] == ',' | s[i] == '!')
                s[i] = ' ';
        int i = 0;
        while (i < s.size()) {
            if (s[i] >= 'A' and s[i] <= 'z') {
                while (i < s.size() and s[i] != ' ')
                    i++;
                cnt++;
            } else
                i++;
        }
    }
    cout << cnt << endl;
}

int main() {
    ios::sync_with_stdio(false),
            cin.tie(nullptr),
            cout.tie(nullptr);
    int t{1};
    while (t--) {
        De_lesseps();
    }
    return 0;
}
Leave a Comment