Cod sursa(job #1460287)

Utilizator rzvrzvNicolescu Razvan rzvrzv Data 12 iulie 2015 12:10:01
Problema Text Scor 80
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.71 kb
#include<cstdio>
#include<cstring>

using namespace std;

char s[2000002];
int nrc,nrl,n,i;
bool ok;

int main()
{
    freopen("text.in","r",stdin);
    freopen("text.out","w",stdout);
    nrc=0;
    nrl=0;
    while(!feof(stdin))
    {
        ok=false;
        gets(s+1);
        n=strlen(s+1);
        for(i=1;i<=n;i++)
        {
            if((s[i]>='a'&&s[i]<='z')||(s[i]>='A'&&s[i]<='Z'))
            {
                if(ok==false)
                {
                    ok=true;
                    nrc++;
                }
                nrl++;
            }
            else
            {
                ok=false;
            }
        }
    }
    printf("%d\n",nrl/nrc);
}