Cod sursa(job #2500648)

Utilizator daniel.lazurcaLazurca Daniel-Vasile daniel.lazurca Data 28 noiembrie 2019 13:56:21
Problema Text Scor 30
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.52 kb
#include <fstream>
#include <cstring>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");

int main()
{
    char s[256];
    f.getline(s,256);
    char *p=strtok(s," ");
    int s1=0,n=0;
    while(p!=NULL)
    {
        bool ok=1;
        for(int i=0; i<strlen(p); i++)
            if(!strchr("zxcvbnmlkjhgfdsaqwertyuiop",p[i]))
            ok=0;
        if(ok)
        {s1+=strlen(p);
        n++;}
        p=strtok(NULL," ");
    }
    if(n!=0)
    g<<s1/n<<'\n';
    else g<<0<<'\n';
}