Cod sursa(job #1574783)
Utilizator | Data | 20 ianuarie 2016 20:35:04 | |
---|---|---|---|
Problema | Text | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.46 kb |
#include <iostream>
#include <fstream>
#include <string.h>
using namespace std;
ifstream fin ("text.in");
ofstream fout ("text.out");
char a;
int lungime=0, nr=0,flag=0;
int main()
{
while(fin.get(a))
{
if((a>='a' && a<='z') || (a>='A' && a<='Z'))
{lungime++;flag=1;}
else
if(flag==1)
{nr++;flag=0;}
}
if (nr==0)
{fout<<0;return 0;}
fout<<lungime/nr;
return 0;
}