Pagini recente » Cod sursa (job #1504532) | Cod sursa (job #1123453) | Cod sursa (job #1306207) | Cod sursa (job #2564055) | Cod sursa (job #308752)
Cod sursa(job #308752)
#include<stdio.h>
#include<string.h>
using namespace std;
FILE *f,*s;
char a,b,sep[200]="_ 1234567890,.?/!;\'-@#$%^&*(){}[]|:<>+~`\n\0\"",lit[200]="aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ",*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);
c3=strchr(lit,a);
if(c1!=NULL&&c2==NULL)
nrc++;
if(c3!=NULL)
nrl++;
b=a;
}
c1=strchr(lit,a);
if(c1!=NULL)
{
nrc++;
nrl--;
}
if(nrc==0)
fprintf(s,"0");
else
fprintf(s,"%lld",nrl/nrc);
fclose(s);
return 0;
}