Cod sursa(job #1110201)

Utilizator gapdanPopescu George gapdan Data 17 februarie 2014 21:20:36
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.43 kb
#include<cstdio>
using namespace std;
char c;
int lg,k;
int main()
{
    freopen("text.in","r",stdin);
    freopen("text.out","w",stdout);
    int ant=0,p=0;
    scanf("%c",&c);
    while(c!='\n')
    {
       if( (c>='a' && c<='z') || (c>='A' && c<='Z') ) p++;
       else
       {
           if(p) ++k;
           lg+=p;
           p=0;
        }
        scanf("%c",&c);
    }
    printf("%d\n",lg/k);
    return 0;
}