Cod sursa(job #308578)
| Utilizator | Data | 27 aprilie 2009 20:48:26 | |
|---|---|---|---|
| Problema | Text | Scor | 80 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.55 kb |
#include<stdio.h>
#include<string.h>
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");
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;
}
fprintf(s,"%lld",nrl/nrc);
fclose(s);
return 0;
}