Cod sursa(job #634013)
| Utilizator | Data | 15 noiembrie 2011 13:49:00 | |
|---|---|---|---|
| Problema | Text | Scor | 30 |
| Compilator | c | Status | done |
| Runda | Arhiva de probleme | Marime | 0.55 kb |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char s[30000];
void citire(){
int l,count=0,i,suma=0;
char *p;
FILE *f=fopen("text.in","r");
FILE *g=fopen("text.out","w");
fgets(s,30000,f);
l=strlen(s);
for(i=0;i<l;i++)
if((s[i]>='a'&&s[i]<='z')||(s[i]>='A'&&s[i]<='Z'))
count++;
p=strtok(s," .,!:;?");
while(p!=NULL){
if(strlen(p)>1)
suma++;
p=strtok(NULL," .,!:;?");
}
fprintf(g,"%d",count/suma);
}
int main()
{
citire();
return 0;
}
