Cod sursa(job #1607295)
Utilizator | Data | 20 februarie 2016 23:14:55 | |
---|---|---|---|
Problema | Text | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.42 kb |
# include <fstream>
# include <string>
# include <cstring>
using namespace std;
ifstream fin("text.in");
ofstream fout("text.out");
const int tMB = 2048;
const char d[] = " -,.?!'_=;:";
char s[tMB], *p;
int w, l;
int main() {
fin.getline(s, tMB);
p = strtok(s, d);
while (p) {
++w;
l += strlen(p);
p = strtok(NULL, d);
}
fout << (l/w);
return 0;
}