Cod sursa(job #28215)

Utilizator undogSavu Victor Gabriel undog Data 7 martie 2007 16:46:57
Problema Text Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.62 kb
#include<stdio.h>

int main(){
 freopen("text.in","rt",stdin);
 freopen("text.out","w+",stdout);

 long i,j,cuv=0,lit=0;
 int k;
 char c,found=0;
 long pos=0,lpos=0;
 for(i=0;!feof(stdin);i++){
  scanf("%c",&c);

  found=0;
  for(k=65;k<91;k++)
   if(c==k){
    found=1;
    break;
   }
  for(k=97;k<123&&!found;k++)
   if(c==k){
    found=1;
    break;
   }
 if(found){
  lit++
  if(aux=0){
   k=1;
   cuv++;
  }
  aux=1;
 }
 else
  aux=0;


 /* if(!found)
   pos=i;

  if(pos!=i){
   lit++;
   continue;
  }
  if(pos-lpos>1){
   cuv++;
   lpos=pos;
  }

 */
 }
printf("%ld",lit/cuv);
}