Cod sursa(job #1235816)

Utilizator thinkphpAdrian Statescu thinkphp Data 30 septembrie 2014 18:48:00
Problema Text Scor 100
Compilator c Status done
Runda Arhiva de probleme Marime 0.86 kb
#include <stdio.h>
#define FIN "text.in"
#define FOUT "text.out"
#define L long

L count_ch = 0, 
  count_wo = 0, 
  len;

int ok = 0;

//function prototypes
void readAndSolve();

int main() {

    readAndSolve();

    return(0); 
}


void readAndSolve() {

     char c;

     freopen(FIN, "r", stdin); 

     freopen(FOUT, "w", stdout); 

     while(!feof( stdin )) {

            scanf("%c", &c); 

            if(!ok && isalpha(c)) {

                ++count_wo;

                ok = 1; 

                ++count_ch;
                           
            } else if(ok && isalpha(c)) {

                      ++count_ch;

            } else if(ok && !isalpha(c)) {

                      ok = 0;
            }           
     }

     printf("%ld",(count_ch)/(count_wo));

     fclose( stdin );

     fclose( stdout );
}