Pagini recente » Cod sursa (job #1358077) | Monitorul de evaluare | Cod sursa (job #1249670) | Cod sursa (job #1008819) | Cod sursa (job #712998)
Cod sursa(job #712998)
//
#include<iostream>
#include<fstream>
#include<string.h>
using namespace std;
int main()
{
char s[65536]="";
int ascii=0,sw=0;
long n_ch=0,n_word=0,n=0;
ifstream fcin("text.in");
ofstream fcout("text.out");
while(!fcin.eof())
{
fcin.getline(s,65536,'\n');
sw=0;
n=strlen(s);
for(int i=0;i<n;i++)
{
ascii=(int) s[i];
if (((ascii>=65)&&(ascii<=90))||((ascii>=97)&&(ascii<=122)))
{
n_ch++;
sw++;
}
else
if ((sw>0)&&(i!=n-1))
{
sw=0;
n_word++;
}
}
if (sw>0)
n_word++;
}
fcout<<n_ch/n_word;
fcin.close();
fcout.close();
return(0);
}