Cod sursa(job #368111)

Utilizator impulseBagu Alexandru impulse Data 23 noiembrie 2009 23:15:50
Problema Text Scor 30
Compilator c Status done
Runda Arhiva de probleme Marime 0.76 kb
#include<stdio.h>
#include <string.h>

int main()
{
    char read[1024];
    freopen("text.in", "r", stdin);
    freopen("text.out", "w", stdout);
    gets(read);
    int length;
    length=strlen(read);
    char text[length];
    int x;
    for(x = 0;x< length;x++)
    {
        if(read[x] >= 48 && read[x] <= 57 || read[x] >=65 && read[x] <=90 || read[x] >=97 && read[x] <= 122)
        text[x] = read[x];
        else
        text[x] = ' ';
    }
    int lcuv =0;
    int cuvlength = 0;
    for(x=0;x<length;x++)
    {
        if(text[x] != ' ')
        {
            cuvlength++;
        }
        else
        {
            if(text[(x-1)] != ' ')
            lcuv++;
        }
    }
    printf("%d",(cuvlength / lcuv));
    return 0;
}