Cod sursa(job #1795424)

Utilizator KrosomAngelo Barbu Krosom Data 2 noiembrie 2016 13:48:35
Problema Text Scor 20
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.52 kb
#include <bits/stdc++.h>
using namespace std;

ifstream f("text.in");
ofstream g("text.out");

char s[500], alf[]="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", spatiu=' ';
int litere, cuvinte=2;

int main()
{
    f.get(s, 500);
    for (int i=0; i<=strlen(s); i++)
        for (int j=0; j<=strlen(alf); j++)
            if (strchr(alf, s[i]))
                litere++;
                else
                if (s[i]==spatiu)
                    cuvinte++;
    g<<litere/cuvinte-1;
    return 0;
}