Pagini recente » Cod sursa (job #1261614) | Cod sursa (job #1261377) | Cod sursa (job #957670) | Cod sursa (job #1331321) | Cod sursa (job #1367719)
#include <iostream>
#include <cstring>
#include <fstream>
using namespace std;
ifstream fin("text.in");
ofstream fout("text.out");
char s[10000];
int media, cnt, cntc;
int main(){
fin.getline(s, 10000);
char sep[] = "_ 1234567890,.?/!;\'-@#$%^&*(){}[]|:<>+~`" ;
char *p = strtok(s, sep);
while(p)
{
cnt++;
for(int i = 0; i < strlen(p); i++)
cntc++;
p = strtok(NULL, sep);
}
if(cnt == 0)
fout<<0;
else
{
media = cntc/ cnt;
fout<<media;
}
return 0;
}