Pagini recente » Cod sursa (job #2916136) | Cod sursa (job #68061) | Cod sursa (job #2586402) | Cod sursa (job #79778) | Cod sursa (job #757904)
Cod sursa(job #757904)
#include <fstream>
#include <string.h>
using namespace std;
char Data[1000005];
int main(void)
{
fstream fin("text.in",ios::in);
fstream fout("text.out",ios::out);
long Count = 0;
long W = 0;
long Len = 0;
long P = 0;
long L = 0;
while (fin >> Data)
{
W = 0;
L = strlen(Data);
for (P = 0;P < L;P += 1)
{
if (((Data[P] >= 'a') && (Data[P] <= 'z')) ||
((Data[P] >= 'A') && (Data[P] <= 'Z')))
{
Len += 1;
W = 1;
}
else
{
if (W == 1)
{
Count += 1;
W = 0;
}
}
}
Count += W;
}
if (Count == 0)
{
fout << 0;
}
else
{
fout << (Len / Count);
}
fin.close();
fout.close();
return 0;
}