Cod sursa(job #1148514)

Utilizator robertkarolRobert Szarvas robertkarol Data 20 martie 2014 20:45:09
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.66 kb
#include <fstream>
#include <cstring>
#include <cstdio>
using namespace std;
//FILE *fin=fopen("text.in","r")
ifstream fin("text.in");
ofstream fout("text.out");
long long i,l,k,nr;
char s[999999];
int main()
{
    fin.getline(s,999999);
    nr=0;l=0;k=0;
    for(i=0;s[i]!=0;i++)
    {
        if((s[i]>='a'&&s[i]<='z')||(s[i]>='A'&&s[i]<='Z'))
           {
               l++;
               if(strchr("abcdefghijklmnopqrstuvwzyxABCDEFGHIJKLMNOPQRSTUVWXYZ",s[i+1])==0)
               {
                   k++;
                   nr+=l;
                   l=0;
               }
           }

    }
    if(k!=0)
    fout<<nr/k;
    return 0;
}