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