Cod sursa(job #286528)

Utilizator firewizardLucian Dobre firewizard Data 23 martie 2009 21:27:35
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.63 kb
#include <stdio.h>  
#include <string>   
#define cuv(c) (((c) >= 'a' && (c) <= 'z') || ((c) >= 'A' && (c) <= 'Z')?1:0)   
char c[2048*1024];   
int main()   
{   
    long n, nc = 0, nl = 0, i;   
    freopen("text.in","r",stdin);  
    freopen("text.out", "w", stdout);  
    fgets(c,sizeof(c),stdin);  
    n=strlen(c);  
    c[n]=' ';   
    for (i = 0; i < n; i++){   
        if (cuv(c[i])){   
           nl++;   
           if(!cuv(c[i+1]))nc++;   
           }   
        }   
       
    /*printf("%ld\n%ld\n%ld\n%ld\n",n,nl,nc,(long)(nl/nc));*/  
    printf("%ld\n",(long)(nl/nc));  
    return 0;   
}