Cod sursa(job #1148474)

Utilizator robertkarolRobert Szarvas robertkarol Data 20 martie 2014 20:15:20
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.53 kb
#include <fstream>
#include <cstring>
using namespace std;
ifstream fin("text.in");
ofstream fout("text.out");
long long i,l,k,nr;
char s[101];
int main()
{
    fin.getline(s,101);
    nr=0;
    for(i=0;i<strlen(s);i++)
    {
        if(strchr("abcdefghijklmnopqrstuvwzyxABCDEFGHIJKLMNOPQRSTUVWXYZ",s[i])!=0)
            l++;
        else
        {
            if(l!=0)
            {
                nr=nr+l;
                k++;
                l=0;
            }
        }
    }
    fout<<nr/k;
    return 0;
}