Cod sursa(job #245219)

Utilizator SheepBOYFelix Liviu SheepBOY Data 17 ianuarie 2009 11:57:28
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.82 kb
   #include<stdio.h>  
   #include<string.h>  
   int what(char c)  
   {  
        if(c>='a'&&c<='z'||c>='A'&&c<='Z')  
           return 1;  
       return 0;  
   }  
    int main()  
   {  
       char board[131000];  
       long long overall=0,words=0,enter=0,i,n;  
       freopen("text.in","r",stdin);  
       freopen("text.out","w",stdout);  
       gets(board);  
       n=strlen(board);  
       for(i=0;i<n;++i)  
       {  
           enter=0;  
           while(what(board[i])&&i!=n)  
           {  
               if(!enter)  
               {  
                   ++words;  
                   enter=1;  
               }  
               ++overall;  
           ++i;  
           }  
       }  
	  // printf("%lld %lld\n",overall,words);
       printf("%lld",overall/words);  
   }