Cod sursa(job #186275)

Utilizator firewizardLucian Dobre firewizard Data 27 aprilie 2008 04:20:12
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.6 kb
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <iostream>
#include <fstream>
using namespace std;
#define LIT(c) (((c) >= 'a' && (c) <= 'z') || ((c) >= 'A' && (c) <= 'Z')) 
char buf[2048*1024]; 
int main() 
{ 
    int n, nc = 0, nl = 0, i; 
    freopen ("text.in","r",stdin); 
    fgets(buf,2048*1024,stdin);
    n=strlen(buf)-1; 
    buf[n] = ' '; 
    for (i = 0; i < n; i++){ 
        if (LIT(buf[i])){ 
           nl++; 
           if (!LIT(buf[i+1])) nc++; 
           } 
        } 
    freopen("text.out", "w", stdout); 
    printf("%d\n", nl/nc); 
    return 0; 
}