Pagini recente » Cod sursa (job #2189800) | Cod sursa (job #288) | Cod sursa (job #1908873) | Cod sursa (job #1859971) | Cod sursa (job #308759)
Cod sursa(job #308759)
#include<stdio.h>
#include<string.h>
using namespace std;
FILE *f,*s;
char a,b,sep[200]="_ 1234567890,.?/!;\'-@#$%^&*(){}[]|:<>+~`\n\0\"",*c1,*c2,*c3;
long long int nrc,nrl;
int main()
{
f=fopen("text.in","r");
s=fopen("text.out","w");
b=' ';
while(!feof(f))
{
fscanf(f,"%c",&a);
c1=strchr(sep,a);
c2=strchr(sep,b);
if(c1!=NULL&&c2==NULL)
nrc++;
if(c1==NULL)
nrl++;
b=a;
}
//if(c1==NULL)
// nrc--;
printf("%lld",nrc);
if(nrc==0)
fprintf(s,"0");
else
fprintf(s,"%lld",nrl/nrc);
fclose(s);
return 0;
}