Cod sursa(job #739136)

Utilizator alex_d01Alex Silviu alex_d01 Data 22 aprilie 2012 11:51:19
Problema Text Scor 30
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.69 kb
#include <cstdio>
using namespace std;

int main()
{
    freopen("text.in","r",stdin);
    freopen("text.out","w",stdout);
    unsigned nc = 0,nl = 0;
    char c,s;
    scanf("%c",&c);
    if(c == '-')
    {
        scanf("%c",&s);
        nc = 1;
    }
    else
    {
        nc = 1;
        nl = 1;
    }
    while(c != '!' && c != '.' && c != '?')
    {
        scanf("%c",&c);
        if(c == ' ' || c == '-')
        {
            nc++;
        }
        if(c == ',')
        {
            scanf("%c",&s);
            nc++;
        }
        if((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))
            nl++;
    }
    printf("%d",nl/nc);
    return 0;
}