Cod sursa(job #27527)
Utilizator | Adrian Zahoi adyzaho | Data | 6 martie 2007 14:55:46 |
---|---|---|---|
Problema | Text | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.44 kb |
#include"fstream.h"
#include"string.h"
int main()
{
ifstream in("text.in");
ofstream out("text.out");
long lung=0,nc=0,lc=0;
int i;
char c[2];
while(!in.eof())
{
in.get(c,2);
if( ((strcmp(c,"a")>=0) && (strcmp(c,"z")<=0))||((strcmp(c,"A")>=0)&&(strcmp(c,"Z")<=0)))
lc++;
else
if(lc==0);
else
{
lung+=lc;
nc++;
lc=0;
}
}
out<<(int)lung/nc<<endl;
in.close();
out.close();
return 0;
}