Cod sursa(job #1379061)

Utilizator StarGold2Emanuel Nrx StarGold2 Data 6 martie 2015 16:03:09
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.73 kb
#include <cstdio>
#include <cstring>
#define DIM 2000000
using namespace std;

FILE *fin = fopen("text.in" ,"r");
FILE *fout= fopen("text.out","w");

int n, m, i, j, k, ok, minim, aux;
char c; int nrcuv, nrlit;

int cond(){
     if((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))
          return 1;
     return 0;
}

void Code(){
     while(c != '~'){
          c = '~';
          fscanf(fin, "%c", &c);
          if(cond())
               aux ++;
          else{
               if(aux > 0)
                    nrcuv ++;
               nrlit += aux;
               aux = 0;
          }
     }
     nrlit /= nrcuv;
     fprintf(fout, "%d", nrlit);
     return;
}

int main(){
     Code();
     return 0;
}