Pagini recente » Cod sursa (job #2675562) | Cod sursa (job #1010197) | Cod sursa (job #1022520) | Cod sursa (job #2368803) | Cod sursa (job #1830889)
#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++;
while(((65<=ascii and ascii<=90)or(97<=ascii and ascii<=122))and i<strlen(s)){
litere++;
ascii=int(s[i++]);
}
}
}
if (cuvinte!=0)
fout <<litere/cuvinte;
return 0;
}