Cod sursa(job #1597918)

Utilizator RaresEGaySopterean Adrian RaresEGay Data 12 februarie 2016 14:45:26
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.67 kb
#include<fstream>
#include<string.h>
#define Max 15000
using namespace std;
ifstream fin("text.in");
ofstream fout("text.out");
int Lit, Cuv;
int main(){
    char s[Max];
    int i=0;
    fin.getline(s,Max);
    while(i<strlen(s)){
        if(s[i]>='a' and s[i]<='z' or s[i]>='A' and s[i]<='Z')
            Lit++;
        i++;
    }
    i=0;
    while(i<strlen(s)){
        if(s[i]>='a' and s[i]<='z' or s[i]>='A' and s[i]<='Z' or s[i]=='-'){
            Cuv++;
            while(s[i]>='a' and s[i]<='z' or s[i]>='A' and s[i]<='Z' or s[i]=='-')
                i++;
        }
        else i++;
    }
    int Medie;
    Medie = Lit/Cuv;
    fout<< Medie;
}