Cod sursa(job #908609)

Utilizator enedumitruene dumitru enedumitru Data 9 martie 2013 20:04:12
Problema Text Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.41 kb
#include <fstream> 
//#include <string.h> 
using namespace std; 
ifstream f("text.in"); ofstream g("text.out"); 
int n,nrc,l; 
char s; 
int cifra(int x) 
{   if (x>='a' && x<='z' || x>='A' && x<='Z') return 1; 
    return 0; 
} 
int main() 
{   while (f.get(s)) 
    {   if (!cifra(s) && n) {nrc++; n=0;} 
        if (cifra(s)) {l++; n=1;} 
    }
	if (nrc==0) nrc=1;
	g<<l/nrc; g.close(); return 0; 
}