Cod sursa(job #914528)
Utilizator | Data | 14 martie 2013 11:21:28 | |
---|---|---|---|
Problema | Text | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.5 kb |
#include <fstream>
#include <cstring>
using namespace std;
#define MAXN 1100000
char t[MAXN];
int main()
{
char *p, *p_vechi;
unsigned int i = 0, suma = 0;
ifstream fin("text.in");
ofstream fout("text.out");
fin.getline(t,MAXN);
fin.close();
p = strtok(t," ,.-!");
while(p){
p_vechi = p;
p = strtok(NULL, " ,.-!");
suma += strlen(p_vechi);
i++;
}
if(i) fout << suma/i << "\n";
fout.close();
return 0;
}