Cod sursa(job #1460286)

Utilizator rzvrzvNicolescu Razvan rzvrzv Data 12 iulie 2015 12:07:11
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.6 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);
    gets(s+1);
    ok=false;
    nrc=0;
    nrl=0;
    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);
}