Cod sursa(job #1780455)

Utilizator adiboierAdi Boier adiboier Data 16 octombrie 2016 11:27:31
Problema Text Scor 30
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.51 kb
#include <fstream>
#include <string>
#include <algorithm>
#include <cstring>
using namespace std;
ifstream fin("text.in");
ofstream fout("text.out");
int main()
{
    string s;
    string delim=",-.!? ";
    getline(fin,s);
    int cuv=0;
    int len=0;
    int ok=0;
    for(int i=0;i< int(s.size());++i)
    {
        if(isalpha(s[i]))
        {
            len++;
            ok=1;
        }
        else if(ok==1 && isalpha(s[i])==0)
            cuv++;
    }
    fout<<len/cuv;
    return 0;
}