Pagini recente » Cod sursa (job #1625971) | Cod sursa (job #2324038) | Cod sursa (job #1125437) | Cod sursa (job #2794867) | Cod sursa (job #1428461)
#include<iostream>
#include<fstream>
#include<cstring>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
char alfabet[]="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",S[1200],*p;
int nr,x,Sum,k;
int main ()
{
f.get(S,1200);
do
{
nr++;
}while(!strchr(alfabet,S[nr]));
p=strtok(S+nr," ,:;.?!-1234567890");
while(p)
{
x=strlen(p);
Sum+=x;
k++;
p=strtok(NULL," ,:;.?!-1234567890");
}
if(k==0)
g<<0;
else
g<<Sum/k;
return 0;
}