Cod sursa(job #2061597)

Utilizator nerelog25Radu Andrei Stefan nerelog25 Data 9 noiembrie 2017 15:35:46
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.38 kb
#include <iostream>
#include <fstream>
#include <cstring>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
char s[256],*p;
int main()
{f.get(s,256);
p=strtok(s," ,");
int nr=0,s=0;
while(p)
{
    nr++;
    for(int i=0;i<strlen(p);i++)
        if(('a'<=p[i] && p[i]<='z') ||('A' <=p[i] && p[i]<='Z')) s++;
    p=strtok(NULL," ,");
}
g<<s/nr;
return 0;
}