Pagini recente » Cod sursa (job #1309292) | Cod sursa (job #1951041) | Cod sursa (job #1854231) | Cod sursa (job #352800) | Cod sursa (job #1830876)
#include <iostream>
#include <fstream>
#include <cstring>
using namespace std;
ifstream fin ("text.in");
ofstream fout ("text.out");
int main(){
char s[500000];
int litere=0,cuvinte=0,ascii;
fin.getline(s,500000,'\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;
}