Cod sursa(job #1338557)

Utilizator fanache99Constantin-Buliga Stefan fanache99 Data 10 februarie 2015 09:17:50
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.47 kb
#include<stdio.h>
#include<cstring>
using namespace std;
int main(){
    freopen("text.in","r",stdin);
    freopen("text.out","w",stdout);
    int l=0,nr=0,pp=0,i;
    char c;
    while(scanf("%c",&c)!=EOF)
        if((c>='a'&&c<='z')||(c>='A'&&c<='Z')){
            l++;
            if(pp==0)
                nr++;
            pp=1;
        }
        else
            pp=0;
    if(nr!=0)
        printf("%d",l/nr);
    else
        printf("0");
    return 0;
}