Pagini recente » Cod sursa (job #2793546) | Cod sursa (job #2158964) | Cod sursa (job #1295601) | Cod sursa (job #445749) | Cod sursa (job #2810673)
#include <iostream>
#include <fstream>
#include <cstring>
using namespace std;
ifstream in("text.in");
ofstream out("text.out");
int lenght, wordsN;
int main()
{
char text[1000000];
in.get(text,999999);
char *cuvant;
cuvant = strtok(text," .,-!?");
while (cuvant != NULL)
{
lenght += strlen(cuvant);
++wordsN;
cuvant = strtok(NULL," .,-!?");
}
if(lenght == 0 || wordsN == 0)
out << 0;
else
out << lenght / wordsN;
return 0;
}