Pagini recente » Cod sursa (job #1882984) | Cod sursa (job #184887) | Cod sursa (job #85595) | Cod sursa (job #1111340) | Cod sursa (job #734232)
Cod sursa(job #734232)
#include <iostream>
#include <stdio.h>
using namespace std;
char text[100000], a;
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=2;i<=nr;i++)
{
if(text[i] == ' ' && (text[i-1] != '.' || text[i-1] != ',' || text[i-1] != '-' || text[i-1] != ';' || text[i-1] != '?' || text[i-1] != '!' || text[i-1] != ':' || text[i-1] != '"' || text[i-1] != '`') )
{
nr_cuv++;
}
if (text[i] != ' ' && text[i] != '.' && text[i] != ',' && text[i] != '-' && text[i] != ';' && text[i] != '?' && text[i] != '!' && text[i] != ':' && text[i] != '"' && text[i] != '`')
{
nr_crt++;
}
}
nr_cuv++;
if (text[1] != ' ' && text[1] != '.' && text[1] != ',' && text[1] != '-' && text[1] != ';' && text[1] != '?' && text[1] != '!' && text[1] != ':' && text[1] != '"' && text[1] != '`')
{
nr_crt++;
}
rez = nr_crt / nr_cuv;
printf("%lld ", rez);
}