Cod sursa(job #1209673)

Utilizator blackoddAxinie Razvan blackodd Data 18 iulie 2014 12:20:23
Problema Text Scor 30
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.53 kb
#include <fstream>
#include <cstring>
#include <cctype>
using namespace std;

ifstream fin("text.in");
ofstream fout("text.out");

char s[2000000];
char sep[] = "  -.,!?/;:][{}=+_|\'";
int lit, cuv;

int main()
{
    fin.getline(s, 2000001, EOF);
    int n = strlen(s);
    for ( int i = 0; i < n; ++i )
        if ( isalpha(s[i]) ) lit++;
    char* p = strtok(s, sep);
    while (p)
    {
        cuv++;
        p = strtok(NULL, sep);
    }
    fout << lit / cuv;

    fin.close();
    fout.close();
    return 0;
}