Cod sursa(job #2022687)

Utilizator FunnyStockyMihnea Andreescu FunnyStocky Data 16 septembrie 2017 22:59:28
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.7 kb
#include <fstream>
#include <cstring>
using namespace std;
ifstream cin("text.in");
ofstream cout("text.out");
bool f(char ch)
{
    if('a'<=ch and ch<='z')
        return 1;
    if('A'<=ch and ch<='Z')
        return 1;
    return 0;
}
int main()
{
    ios_base::sync_with_stdio(0);
    char s[1100005];
    int sum=0,nr=0;
    while(cin.getline(s,1100000))
    {
        int n=strlen(s);
        for(int i=0;i<n;i++)
        {
            if(f(s[i]))
            {
                nr++;
                while(f(s[i]))
                    {
                    sum++;
                    i++;
                    }
            }
        }
    }
    cout<<sum/nr;
    return 0;
}