Cod sursa(job #1151839)
Utilizator | Data | 24 martie 2014 13:19:54 | |
---|---|---|---|
Problema | Text | Scor | 50 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.52 kb |
#include <stdio.h>
using namespace std;
int main()
{
FILE *fin,*fout;
fin=fopen("text.in","r");
fout=fopen("text.out","w");
char ch;
int c1=0,c2=0;
bool as=1;
while(!feof(fin))
{
fscanf(fin,"%c",&ch);
if('a'<=ch&&'z'>=ch) {as=0; c1++;}
else if('A'<=ch&&'Z'>=ch) {c1++; as=0;}
else
{
if(as==0)
{
c2++;
}
as=1;
}
}
c2++;
fprintf(fout,"%i",c1/c2);
}