Cod sursa(job #2218092)
Utilizator | Data | 3 iulie 2018 12:53:57 | |
---|---|---|---|
Problema | Text | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.38 kb |
#include <fstream>
#include <string.h>
using namespace std;
const int INT=1024;
ifstream in("text.in");
ofstream out("text.out");
int main(){
char s[INT],*p;
int caractere=0;
int cuvinte=0;
in.get(s,INT);
p=strtok(s,"-,.!? ");
while(p!=NULL){
cuvinte++;
caractere+=strlen(p);
p=strtok(NULL,"-,.!? ");
}
out<<caractere/cuvinte;
return 0;
}