Cod sursa(job #2781558)

Utilizator Nitr0genVlad Ioan Nitr0gen Data 9 octombrie 2021 20:02:13
Problema Text Scor 40
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.46 kb
#include <bits/stdc++.h>
using namespace std;
 
ifstream fin ("text.in");
ofstream fout("text.out");

int main() {
    char a[255];
    fin.get(a, 255);
    int tot = 0, nr = 0;
    for(int i = 0; i < strlen(a); i++) {
        if((a[i] >= 'a' && a[i] <= 'z') || (a[i] >= 'A' && a[i] <= 'Z')) {
            nr++;
            while((a[i] >= 'a' && a[i] <= 'z') || (a[i] >= 'A' && a[i] <= 'Z')) { i++; tot++; }
        }
    }
    fout << tot / nr << '\n';
}