Cod sursa(job #2397411)

Utilizator robertrRotaru Stefan Robert robertr Data 4 aprilie 2019 13:17:07
Problema Text Scor 40
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.48 kb
#include <fstream>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
long long nr,nrc,l;
char x;
int main()
{
    x=f.get();
    l=0;
    while(x!='\n')
    {
        if(x<='z'&&x>='a'||x<='Z'&&x>='A')
            l++;
        else
        {
            if(l)
                nr+=l,nrc++;
            l=0;
        }
        x=f.get();
    }
    if(l)
        nr+=l,nrc++;
    if(nrc)
        g<<nr/nrc<<'\n';
    else g<<0;
    return 0;
}