Pagini recente » Cod sursa (job #3284371) | Rating UTI Gilca Gheorghita Nutu (UTI_Gilca_Gheorghita_Nutu) | Cod sursa (job #3127165) | Profil UCV_Berbec_Bangau_Bucur | Cod sursa (job #3215258)
#include<iostream>
#include<fstream>
#include<algorithm>
#include<string.h>
using namespace std;
ifstream fin("text.in");
ofstream fout("text.out");
int main(){
char s[255],*p,sep[]=" -,!?";
fin.getline(s,255);
p=strtok(s,sep);
int nrcuvinte=0,lungime=0;
while(p){
if(strchr(sep,p[0]))p=strtok(NULL,sep);
else {
nrcuvinte++;
int x=strlen(p);
lungime+=x;
}
p=strtok(NULL,sep);
}
fout<<lungime/nrcuvinte;
}