Cod sursa(job #215429)
Utilizator | Ionescu Maria-Dorina Ionescu_Maria | Data | 18 octombrie 2008 17:24:59 |
---|---|---|---|
Problema | Text | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.38 kb |
#include<fstream.h>
long l,nr;
int sw;
char c;
int main()
{
ifstream fin("text.in");
nr=0; sw=1;
while(!fin.eof())
{c=fin.get();
if((c>='a'&&c<='z')||(c>='A'&&c<='Z'))
{l++;
if(sw==1)
{nr++; sw=0;}
}
else
sw=1;
}
fin.close();
if((c>='a'&&c<='z')||(c>='A'&&c<='Z'))
l--;
ofstream fout("text.out");
fout<<l/nr<<'\n';
fout.close();
return 0;
}