Pagini recente » Cod sursa (job #2212246) | Diferente pentru registru-diplome intre reviziile 21 si 20 | Cod sursa (job #1633740) | Istoria paginii utilizator/mackiea6773 | Cod sursa (job #2022677)
#include <fstream>
using namespace std;
ifstream cin("text.in");
ofstream cout("text.out");
int main()
{
ios_base::sync_with_stdio(0);
long long s=0,st=-1,nr=0,i=1;
bool cuv=0;
char ch;
while(1)
{
ch=cin.get();
if(ch=='\n')
{
if(cuv==1)
{
s+=i-st;
nr++;
}
break;
}
bool is=0;
if('a'<=ch and ch<='z')
is=1;
if('A'<=ch and ch<='Z')
is=1;
if(cuv==0 and is==1)
{
cuv=1;
st=i;
}
if(cuv==1 and is==0)
{
cuv=0;
s+=i-st;
nr++;
}
i++;
}
cout<<s/nr;
return 0;
}