Cod sursa(job #1047759)

Utilizator TediConstantinescu Adrian Tedi Data 4 decembrie 2013 20:59:21
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.57 kb
#include <iostream>
#include <cstdio>
#include <string.h>
#include <fstream>
using namespace std;
int main() 
{
	ifstream fin("text.in");
	ofstream fout("text.out");

	
	char ch;
	int nr_cuv=0;
	int suma_cif=0;
	int ok=0;
 
	ch=getchar();
    while(fin.get(ch))
    {
        if((ch>='a'&& ch<='z' )||(ch>='A' && ch<='Z'))
            {
                suma_cif++;
                ok=1;
            }
		else if(ok==1)
        {
            ok=0;
            nr_cuv++;
        }
    }
   if(ok==1)
	   nr_cuv++;
   fout<<suma_cif/nr_cuv;
 
   return 0;
}