Cod sursa(job #2222999)
| Utilizator | Data | 18 iulie 2018 19:56:59 | |
|---|---|---|---|
| Problema | Text | Scor | 40 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.49 kb |
#include <iostream>
#include <fstream>
#include <string.h>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
int main()
{
char s[256],sep[]=".,?! -",*p,cuv[20];
int k=0,n=0;
f.get(s,256);
while((s[0]<'a' || s[0]>'z') && (s[0]<'A' || s[0]>'Z'))
strcpy(s,s+1);
p=strtok(s,sep);
while(p!=NULL)
{
strcpy(cuv,p);
k=k+strlen(cuv);
n++;
p=strtok(NULL,sep);
}
g<<k/n;
return 0;
}
