Cod sursa(job #2087534)
Utilizator | Data | 13 decembrie 2017 19:46:10 | |
---|---|---|---|
Problema | Text | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.61 kb |
#include<fstream>
using namespace std;
ifstream fin("text.in");
ofstream fout("text.out");
int main()
{
char c;
int lungime=0,ok=0,s=0,cuv=0;
while(fin.get(c))
{
if (isalpha(c)!=0 && ok==1)
lungime++;
else
if(isalpha(c)!=0 && ok==0)
{
lungime=1;
ok=1;
}
else
if(isalpha(c)==0 && ok==1)
{
cuv++;
s=s+lungime;
lungime=0;
ok=0;
}
}
fout<<s/cuv;
}