Pagini recente » Cod sursa (job #1597270) | Cod sursa (job #2109611) | Cod sursa (job #426126) | Cod sursa (job #2818059) | Cod sursa (job #2218167)
#include<iostream>
#include<fstream>
#include<string.h>
using namespace std;
int main()
{ ifstream f("text.in");
ofstream g("text.out");
char s[1000002];
long double l=0,nr=0;
bool iuytresxcvbhju =0;
while(!f.eof()){
f.getline(s,1000000);
for(int i=0;s[i];i++){
if(isalpha(s[i])){
l++;
iuytresxcvbhju=1;
}
else if(iuytresxcvbhju){// daca precedentul a fost litera
iuytresxcvbhju=0;
nr++;
}
}
}
if(iuytresxcvbhju) nr++;
if(nr!=0)g<<l/nr<<endl;
else g<<0;
f.close();
g.close();
}