Cod sursa(job #2599837)

Utilizator tonitzasimKevin Simon tonitzasim Data 11 aprilie 2020 19:31:13
Problema Text Scor 100
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.62 kb
#include<bits/stdc++.h>
using namespace std;
ifstream in("text.in");
ofstream out("text.out");
char a[2000001];
int main(){
int i=0,medie,litere=0,cuvinte=0;
char n,p;
while(!in.eof())
{
    in.get(n);
    if(i==0){
        if((n>='a'&&n<='z')||(n>='A'&&n<='Z'))
        {
            cuvinte++;
            litere++;
        }
    }
    else {
        if((n>='a'&&n<='z')||(n>='A'&&n<='Z')){
        litere++;
            if((p<'A'||(p>'Z'&&p<'a')|| p>'z'))
               cuvinte++;
        }
    }
    i++;
    p=n;
}
if(litere==0)
    out<<0;
else {
    medie=litere/cuvinte;
    out<<medie;
}
}