Cod sursa(job #597649)
Utilizator | FMI Ekart Dragos-Ioan fulgerulnegru | Data | 22 iunie 2011 18:29:52 |
---|---|---|---|
Problema | Text | Scor | 80 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.63 kb |
#include<fstream>
#include<iostream>
using namespace std;
ifstream in ("text.in");
ofstream out ("text.out");
int main (){
char c;
int t=0;
in>>c;
int suma=0,nr=0;
while(!in.eof()){
c=in.get();
t=0;
if((c>='a'&&c<='z')||(c>='A'&&c<='Z')){
suma++;
nr++;
t=1;
}
while(t==1){
c=in.get();
t=0;
if((c>='a'&&c<='z')||(c>='A'&&c<='Z')){
nr++;
t=1;
}
}
if(in.eof())
break;
}
suma=nr/suma;
out<<suma;
in.close();
out.close();
return 0;
}