Cod sursa(job #2201000)

Utilizator toadehuPuscasu Razvan Stefan toadehu Data 3 mai 2018 09:21:16
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.64 kb
#include <bits/stdc++.h>

using namespace std;

char text[300009];

int nr,nrc;
bool vf;

int main()
{
    ifstream fin ("text.in");
    ofstream fout ("text.out");
    while (fin>>text)
    {
        for (int i=0;i<strlen(text);++i)
        {
            if (isalpha(text[i]))
            {
                nr++;
                vf=1;
            }
            else
            {
                if (vf)
                {
                    nrc++;
                    vf=0;
                }
            }
        }
        if (vf)
        {
            nrc++;
            vf=0;
        }
    }
    fout<<nr/nrc;
}