Cod sursa(job #965183)

Utilizator rekingCretu Bogdan reking Data 23 iunie 2013 17:22:19
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.57 kb
#include <iostream>
#include <fstream>
#include <string.h>
#define NMax 60000001
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
char text[NMax];
int main ()
{
    unsigned long long cuv=0,litere=0,i,n,rez;
    bool ok=0;
    f.getline(text,NMax);
    n=strlen(text);
    for (i=0;i<n;i++)
    {
        while ((65<=text[i] && text[i]<=90) || (97<=text[i] && text[i]<=122)) {ok=1;i++;litere++;}
        if (ok)
        {
            cuv++;
            ok=0;
        }
    }
    cout<<litere<<" "<<cuv;
    rez=litere/cuv;
    g<<rez;
}