Cod sursa(job #2850542)

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