Cod sursa(job #2764250)

Utilizator DordeDorde Matei Dorde Data 20 iulie 2021 01:01:08
Problema Text Scor 100
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.54 kb
#include <bits/stdc++.h>
using namespace std;
int const SZ = 1e6;
char buff [SZ];
int getword (int &p){
    int r = 0;
    while (p != SZ && ! isalpha (buff [p]))
        ++ p;
    while (p != SZ && isalpha (buff [p]))
        ++ r , ++ p;
    return r;

}
int main (){
    freopen ("text.in" , "r" , stdin);
    freopen ("text.out" , "w" , stdout);
    fread (buff , 1 , SZ , stdin);
    int p = 0 , L = 0 , lit , cuv = 0;
    while (lit = getword (p))
        ++ cuv , L += lit;
    printf ("%d" , L / cuv);
    return 0;
}