// source problem : 
#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(), x.end()
#define int long long
#define lb lower_bound
#define ub upper_bound
#define MASK(i) (1LL << (i))
const int inf = 1e18;
void ckmax(int& f, int s)
{
    f = (f > s ? f : s);
}
void ckmin(int& f, int s)
{
    f = (f < s ? f : s);
}
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    string s;
    int ans = 0;
    int has = 0;
    while (cin >> s) {
        if (s.back() == '.' || s.back() == '?' || s.back() == '!') {
            has = 1;
            s.pop_back();
        }
        if (s.size() && isupper(s[0])) {
            s[0] = tolower(s[0]);
            int ok = 1;
            for (char c : s) {
                if (!islower(c)) ok = 0;
            }
            ans += ok;
        }
        if (has) {
            has = 0;
            cout << ans << '\n';
            ans = 0;
        }
    }   
    return 0;
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... |