Cod sursa(job #884853)

Utilizator pulseOvidiu Giorgi pulse Data 21 februarie 2013 13:35:36
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.67 kb
#include<fstream>
#include<cstring>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");

char a[110000];
char *w;
int i,nr=0,l,nrc=0;

int main()
{
    int ok=0;
    f.getline(a,110000);
    l=strlen(a);
    for(i=0;i<l;i++)
    {
        if((a[i]>='a'&& a[i]<='z')||(a[i]>='A' && a[i]<='Z'))
        {
            nrc++;
            ok=1;
        }
        else
        {
            if(ok==1)
            {
                nr++;
                ok=0;
            }
        }
    }
   /* w=strtok(a," ?:!+;(),.-");
    while(w!=NULL)
    {
        nr++;
        w=strtok(NULL, " ?:!+;(),.-");
    }*/
    g<<nrc/nr;
    return 0;
}