Cod sursa(job #1091862)

Utilizator Breje_RaulRaul Breje Breje_Raul Data 26 ianuarie 2014 04:04:48
Problema Text Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.66 kb
#include <iostream>
#include <fstream>

using namespace std;

#define dimen 100001

int n,nr,noword,noletters=0;
string s;

int main(){
    //#ifndef ONLINE_JUDGE
    //    freopen("test.in", "r", stdin);
        //freopen("test.out", "w", stdout);
    //#endif

    ifstream f("text.in");
    ofstream g("text.out");
    getline(f, s);
    for (int i=0;i<s.size()-1;++i){
        if (s[i]==' ' or s[i]=='-' and s[i+1]>='a' and s[i+1]<='z' or s[i+1]>='A' and s[i+1]<='Z'){
            noword++;
        }
        if (s[i]>='a' and s[i]<='z' or s[i]>='A' and s[i]<='Z'){
            noletters++;
        }
    }
    cout << noletters / noword;
}