Cod sursa(job #880709)

Utilizator florin_hanganHangan Florin florin_hangan Data 17 februarie 2013 10:15:26
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.53 kb
#include <fstream>
#include <string.h>
using namespace std;

ifstream is("text.in");
ofstream os("text.out");

struct {
    char c[1000];
    int k;
} a[1000];

int nr, nr_cuv;
const char v[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main()
{
    for ( int i = 0; is >> a[i].c; i++ )
    {
        a[i].k = strlen(a[i].c );
        nr_cuv++;
        for ( int j = 0; j < a[i].k; ++j )
            if(strchr(v, a[i].c[j] ) )
                nr++;
    }
    os << nr / nr_cuv;
    return 0;
}