Cod sursa(job #2897224)

Utilizator YosifIosif Andrei Stefan Yosif Data 2 mai 2022 22:40:22
Problema Text Scor 40
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.54 kb
#include <bits/stdc++.h>
using namespace std;
ifstream fin("text.in");
ofstream fout("text.out");
bool let(char c) {
    return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
}
int main() {
    string s;
    getline(fin, s);
    int lgt = 0, nrc = 0, lg = s.length();
    int i = 0;
    while (i < lg && !let(s[i]))
        i++;
    while (i < lg)
    {
        nrc++;
        while (i < lg && let(s[i]))
            i++, lgt++;
        while (i < lg && !let(s[i]))
            i++;
    }
    fout << lgt / nrc;
    return 0;
}