Pagini recente » Cod sursa (job #2686615) | Cod sursa (job #355665) | Cod sursa (job #1242206) | Cod sursa (job #3147851) | Cod sursa (job #2203550)
#include <bits/stdc++.h>
using namespace std;
char c[1200];
char sep[]=". , - ; ! ?>= # ()<";
int n,lungime,cuvinte,i;
ifstream fin("text.in");
ofstream fout("text.out");
bool litera(char c)
{
if((c>='a'&&c<='z')||(c>='A'&&c<='Z'))
return 1;
}
int main()
{
fin.get(c,1200);
char *p=strtok(c,sep);
char s[150];
while(p!=NULL)
{
n=strlen(p);
strcpy(s,p);
bool ok=0;
for(i=0; i<=n; i++)
{
if(litera(s[i])==1)
{
lungime++;
ok=1;
}
else if(ok==1)
{
cuvinte++;
ok=0;
}
}
p=strtok(NULL,sep);
}
fout<<lungime/cuvinte;
return 0;
}