Mai intai trebuie sa te autentifici.

Cod sursa(job #1830880)

Utilizator lucian8132134Iulian lucian8132134 Data 17 decembrie 2016 11:13:25
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.65 kb
#include <iostream>
#include <fstream>
#include <cstring>

using namespace std;

ifstream fin ("text.in");
ofstream fout ("text.out");
int main(){
    char s[1000001];
    int litere=0,cuvinte=0,ascii;
    fin.getline(s,1000001,'\n');
    for (int i=0;i<strlen(s);i++){
        ascii=int(s[i]);
        if ((65<=ascii and ascii<=90)or(97<=ascii and ascii<=122)){
            cuvinte++;
            for (;((65<=ascii and ascii<=90)or(97<=ascii and ascii<=122))and i<strlen(s);i++){
                litere++;
                ascii=int(s[i+1]);
            }
        }
    }
    if (cuvinte!=0)
        fout <<litere/cuvinte;
    return 0;
}