Cod sursa(job #1104116)
| Utilizator | Data | 10 februarie 2014 14:35:32 | |
|---|---|---|---|
| Problema | Text | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.6 kb |
#include<cstdio>
#include<cstring>
#include<cctype>
FILE *in,*out;
using namespace std;
int main()
{
in=fopen("text.in","rt");
char c;
int nrc=0;
int nrl=0;
bool ok=false;
while(!feof(in))
{
fscanf(in,"%c",&c);
if(isalpha(c))
{
nrl++;
if(ok==false)
{
nrc++;
ok=true;
}
}
else
ok=false;
}
fclose(in);
out=fopen("text.out","wt");
fprintf(out,"%ld",nrl/nrc);
fclose(out);
return 0;
}
