Pagini recente » Cod sursa (job #2916126) | Cod sursa (job #899450) | Cod sursa (job #7138) | Cod sursa (job #1903601) | Cod sursa (job #368111)
Cod sursa(job #368111)
#include<stdio.h>
#include <string.h>
int main()
{
char read[1024];
freopen("text.in", "r", stdin);
freopen("text.out", "w", stdout);
gets(read);
int length;
length=strlen(read);
char text[length];
int x;
for(x = 0;x< length;x++)
{
if(read[x] >= 48 && read[x] <= 57 || read[x] >=65 && read[x] <=90 || read[x] >=97 && read[x] <= 122)
text[x] = read[x];
else
text[x] = ' ';
}
int lcuv =0;
int cuvlength = 0;
for(x=0;x<length;x++)
{
if(text[x] != ' ')
{
cuvlength++;
}
else
{
if(text[(x-1)] != ' ')
lcuv++;
}
}
printf("%d",(cuvlength / lcuv));
return 0;
}