Cod sursa(job #2339368)

Utilizator alex12_roGuster Alexandru alex12_ro Data 8 februarie 2019 19:47:43
Problema Text Scor 40
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.41 kb
#include <iostream>
#include <cstring>
#include <fstream>

using namespace std;

ifstream f("text.in");
ofstream g("text.out");

char s[1000],*p;
int x,nr,nr2,c;
int main()
{
    int i;
    f.getline(s,101);
    x=strlen(s);



    p=strtok(s," ");
    while(p!=NULL)
    {
    nr2++;
    nr += strlen(p);
    p=strtok(NULL," ");
    }


        c=nr/nr2;



    g<<c;
    return 0;
}