Cod sursa(job #914553)
Utilizator | Data | 14 martie 2013 11:37:25 | |
---|---|---|---|
Problema | Text | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.56 kb |
#include <fstream>
#include <cstring>
using namespace std;
#define MAXN 1100000
char t[MAXN];
int main()
{
char *p, sir[] = " `~1234567890!@#$%^&*()-+={}[]|:;'<>,.?/\\";
unsigned int i = 0, suma = 0;
ifstream fin("text.in");
ofstream fout("text.out");
while(!fin.eof()){
fin.getline(t,MAXN);
p = strtok(t, sir);
while(p){
suma += strlen(p);
p = strtok(NULL, sir);
i++;
}
}
if(i) fout << suma/i << "\n";
fin.close();
fout.close();
return 0;
}