Cod sursa(job #921149)

Utilizator DarkyAngelDarky Angel DarkyAngel Data 20 martie 2013 20:02:59
Problema Text Scor 50
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.55 kb
#include <fstream>
#include <cstring>

using namespace std;

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

int main() {
    char c[128];
    int st,sct;
    st=sct=0;
    f>>c;
    while(!f.eof()) {
        int s=0;
        for(int i=0;i<strlen(c);i++)
            if((c[i]>='a'&&c[i]<='z')||(c[i]>='A'&&c[i]<='Z')) {
                if(i>0&&c[i-1]=='-')
                    sct++;
                else
                    s++;
            }
        st+=s;
        if(s)
            sct++;
        f>>c;
    }
    g<<st/sct;

}