Pagini recente » Cod sursa (job #2245524) | Cod sursa (job #2323991) | Cod sursa (job #1492621) | Cod sursa (job #1943542) | Cod sursa (job #734241)
Cod sursa(job #734241)
#include <iostream>
#include <stdio.h>
using namespace std;
char text[10000000], a, aux;
long long nr, i, nr_cuv, nr_crt, rez;
int main()
{
freopen("text.in","r",stdin);
freopen("text.out","w",stdout);
i = 1;
while(scanf("%c", &a) != EOF)
{
text[i] = a;
i++;
}
nr = i-2;
for (i=1;i<=nr;i++)
{
if(text[i] == ' ' && ((text[i+1]>='a' && text[i+1]<='z') || (text[i+1]>='A' && text[i+1]<='Z')) )
{
nr_cuv++;
}
if ((text[i]>='a' && text[i]<='z') || (text[i]>='A' && text[i]<='Z'))
{
nr_crt++;
}
}
nr_cuv++;
rez = nr_crt / nr_cuv;
printf("%lld ", rez);
}