Pagini recente » Cod sursa (job #874230) | Cod sursa (job #2934043) | Cod sursa (job #1306115) | Cod sursa (job #788137) | Cod sursa (job #1830880)
#include <iostream>
#include <fstream>
#include <cstring>
using namespace std;
ifstream fin ("text.in");
ofstream fout ("text.out");
int main(){
char s[1000001];
int litere=0,cuvinte=0,ascii;
fin.getline(s,1000001,'\n');
for (int i=0;i<strlen(s);i++){
ascii=int(s[i]);
if ((65<=ascii and ascii<=90)or(97<=ascii and ascii<=122)){
cuvinte++;
for (;((65<=ascii and ascii<=90)or(97<=ascii and ascii<=122))and i<strlen(s);i++){
litere++;
ascii=int(s[i+1]);
}
}
}
if (cuvinte!=0)
fout <<litere/cuvinte;
return 0;
}