Cod sursa(job #671011)
Utilizator | Data | 30 ianuarie 2012 16:00:20 | |
---|---|---|---|
Problema | Text | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.35 kb |
#include<iostream>
#include<string.h>
#include<fstream>
using namespace std;
int main()
{char s[256], *p, sep[]=" ,?!-";
int nch=0 ,nsb=0;
ifstream F("text.in",ios::in);
ofstream G("text.out",ios::out);
F.getline(s,256);
p=strtok(s,sep);
while(p)
{nsb++;
nch+=strlen(p);
p=strtok(NULL,sep);
}
G<<nch/nsb;
return 0;
}