Cod sursa(job #911722)

Utilizator rares96cheseliRares Cheseli rares96cheseli Data 11 martie 2013 20:40:08
Problema Text Scor 60
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.51 kb
#include <fstream>
#include <string>
#include <algorithm>

using namespace std;

ifstream f("text.in");
ofstream g("text.out");

int lit(char c)
{
    if ((c>='a' && c<='z')||(c<='Z' && c>='Z')) return 1;
     else return 0;
}

int main()
{
    char c; long nrl=0,nrc=0,aux=0;
    while (f.get(c))
    {
        if (lit(c)) aux++;
         else {
                 if (aux>0) nrc++;
                 nrl+=aux; aux=0;
              }
    }
    g<<nrl/nrc;
    f.close();g.close();
    return 0;
}