Pagini recente » Cod sursa (job #2249916) | Cod sursa (job #48658) | Cod sursa (job #566111) | Cod sursa (job #256090) | Cod sursa (job #1312880)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
FILE *f, *g;
if((f=fopen("text.in", "rt"))==NULL)
return -1;
if((g=fopen("text.out", "wt"))==NULL)
return -1;
int l, i, c=0, p=0, o=0;
char *s;
fseek(f, 0, SEEK_END);
l=ftell(f);
fseek(f, 0,0);
s=malloc((l-2)*sizeof(char));
fread(s,sizeof(char),l,f);
for(i=1;i<l;i++)
if((*(s+i)<'a' || *(s+i)>'z') && (*(s+i)<'A' || *(s+i)>'Z'))
if((*(s+i-1)>='a' && *(s+i-1)<='z') || (*(s+i-1)>='A' && *(s+i-1)<='Z'))
{
c++;
p++;
}
else
p++;
l--;
if(c)
o=(l-p)/c;
fprintf(g,"%d",o);
free(s);
fclose(f);
fclose(g);
return 0;
}