Cod sursa(job #905581)

Utilizator paul.chPaul Chelarescu paul.ch Data 5 martie 2013 22:24:02
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.65 kb
#include<fstream>
#include<cstring>
using namespace std;
ifstream fin("text.in");
ofstream fout("text.out");
string s;
inline void citire()
{
    getline(fin, s);
}
int main()
{
    citire();
    long long  nr_cuv = 0, litere = 0;
    for(long long i = 0; i < s.length(); ++i)
    {
        if((s[i] >= 'a' and s[i] <= 'z') or (s[i] >= 'A' and s[i] <= 'Z'))
        {
            nr_cuv++;
            while((s[i] >= 'a' and s[i] <= 'z') or (s[i] >= 'A' and s[i] <= 'Z'))
            {
                ++litere;
                ++i;
            }
        }
    }
    long long sol = litere / nr_cuv;
    fout << sol;
    return 0;
}