Cod sursa(job #2295470)

Utilizator r00t_Roman Remus r00t_ Data 3 decembrie 2018 18:02:23
Problema Text Scor 100
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.62 kb
#include <iostream>
#include <string>
#include <fstream>

using namespace std;

ifstream fin("text.in");
ofstream fout("text.out");

int main()
{
    int rez=0,lit=0;
    string text;
    while(getline(fin, text)){

        for(int i=0; i<text.size(); i++){
            if((text[i]>='a' && text[i]<='z') || (text[i]>='A' && text[i]<='Z')){
                rez++;
                while((text[i]>='a' && text[i]<='z') || (text[i]>='A' && text[i]<='Z') && i<text.size()){
                    i++;
                    lit++;
                }
            }
        }
    }
    fout<<lit/rez;


    return 0;
}