Cod sursa(job #1330836)
Utilizator | Data | 31 ianuarie 2015 00:26:33 | |
---|---|---|---|
Problema | Text | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.43 kb |
#include <fstream>
#include <cstring>
using namespace std;
int main()
{
fstream f,g;
f.open("text.in",ios::in);
g.open("text.out",ios::out);
int nrCuv=0,nrLit=0,l;
char text[100003],*p,sep[]="., :';-_=+?!><[]|)(";
f.getline(text,100002);
p=strtok(text,sep);
do
{
l=strlen(p);
nrCuv++; nrLit+=l;
p=strtok(NULL,sep);
}while(p!=NULL);
g<<nrLit/nrCuv;
}