Pagini recente » Cod sursa (job #3197733) | Cod sursa (job #3200476) | Cod sursa (job #2625099) | Cod sursa (job #2691083) | Cod sursa (job #3279897)
#include <fstream>
#include <cstring>
using namespace std;
ifstream cin("text.in");
ofstream cout("text.out");
int main()
{
int length_sum=0;
int cnt=1;
int length;
bool ok=true;
char text[10000];
cin.get(text,10000);
char* word;
word= strtok(text," ,!:;.?");
length_sum+=strlen(word);
while(word!=NULL){
length=strlen(word);
for(int i=0;i<=strlen(word);i++)
if(!isalnum(word[i]))
length--;
length_sum+=length;
cnt++;
word=strtok(NULL," ");
}
cout<<length_sum/cnt;
return 0;
}