Cod sursa(job #1603584)

Utilizator doroftei1999Doroftei Andrei doroftei1999 Data 17 februarie 2016 17:48:42
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.65 kb
#include <fstream>
#include <cstring>
using namespace std;
ifstream f ("text.in");
ofstream g ("text.out");
char a[99999999];
int k, z, n, i;
bool ok = false;
int main()
{
    while(!f.eof())
    {
        f.get(a,99999999,'\n');
        f.get();
        n = strlen(a);
        for (i = 0; i < n; i++)
        {
            if(isalpha(a[i]))
            {
                while (isalpha(a[i]))
                {
                    k++;
                    i++;
                }
                z++;
                i--;
            }
        }
    }
    if(z == 0)
        g << 0;
    else
        g << k / z;
    return 0;
}