Cod sursa(job #1284631)
Utilizator | Data | 6 decembrie 2014 17:51:01 | |
---|---|---|---|
Problema | Text | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.61 kb |
#include<stdio.h>
using namespace std;
int cuv,lit,k;//nr de cuvinte/nr de litere
char ch;
int main()
{
freopen("text.in","r",stdin);
freopen("text.out","w",stdout);
lit=0;cuv=0;k=0;
while(scanf("%c", &ch)!=EOF)
{
if((ch>='a' && ch<='z') || (ch>='A' && ch<='Z'))
{
lit++;
if(k==0)
{
cuv++;
k=1;
}
}
else
{
k=0;
}
}
if(lit==0)printf("0");
else printf("%d",lit/cuv);
fclose(stdin);
fclose(stdout);
return 0;
}