Cod sursa(job #3279897)
| Utilizator | Data | 24 februarie 2025 19:07:57 | |
|---|---|---|---|
| Problema | Text | Scor | 0 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.57 kb |
#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;
}