Cod sursa(job #734245)

Utilizator mihaitza22Mihai Nan mihaitza22 Data 13 aprilie 2012 21:08:49
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.58 kb
#include <iostream>
#include <stdio.h>
#include <string.h>

using namespace std;

char text[1000000000], a, aux;
long long nr, i, nr_cuv, nr_crt, rez, ok = 0;

int main()
{
    freopen("text.in","r",stdin);
    freopen("text.out","w",stdout);
    i = 1;
    while(!feof(stdin))
	{
		scanf("%c", &a);


		if(  !ok  && isalpha(a) )
			{
				++nr_cuv;
				ok = 1;
				++nr_crt;
			}
		else if(  ok  &&  isalpha(a)  )
			{
				++nr_crt;
			}
		else if(  ok &&  !isalpha(a)  )
			{
				ok = 0;
			}
	}
    rez = nr_crt / nr_cuv;
    printf("%lld ", rez);
}