Cod sursa(job #74380)

Utilizator mircea_infoSuciu Mircea-Gabriel mircea_info Data 25 iulie 2007 12:27:11
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.56 kb
#include<stdio.h>
#include<string.h>
#include<ctype.h>
char c; int nr=0,k=0;
void rezolvare(){
  int ok=0;
  freopen("text.in","r",stdin);
  freopen("text.out","w",stdout);
  c=getc(stdin);
  while(!isalpha(c)&&!feof(stdin))
    c=getc(stdin);
  while(!feof(stdin)){
    ok=0;
    if(isalpha(c)){
      k++;
      c=getc(stdin);
    }
    else{
      ok=1;
      while(!isalpha(c)&&!feof(stdin))
	c=getc(stdin);
      nr++;
    }
  }
  if(ok==0)
    nr++;
  printf("%d",k/nr);
  fclose(stdout);
}
int main(){
  rezolvare();
  return 0;
}