Pagini recente » Cod sursa (job #899276) | Cod sursa (job #2678993) | Cod sursa (job #3176781) | Cod sursa (job #2241458) | Cod sursa (job #2911993)
#include <fstream>
#include <cstring>
using namespace std;
ifstream fin("text.in");
ofstream fout("text.out");
int main(){
int nrcuv=0, lungime_prop=0;
char a[256], *p;
fin.getline(a, 256);
for(int i=0;a[i]!='\0';i++){
if(a[i]>='a' && a[i]<='z')
lungime_prop++;
else if(a[i]>='A' && a[i]<='Z')
lungime_prop++;
else continue;
}
p=strtok(a, " -,!.?;");
while(p){
nrcuv++;
p=strtok(NULL, " -,!.?;");
}
int k;
k=lungime_prop/nrcuv;
fout<<k;
return 0;
}