Cod sursa(job #1758469)
Utilizator | Data | 17 septembrie 2016 12:26:56 | |
---|---|---|---|
Problema | Text | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.6 kb |
#include <iostream>
#include <stdio.h>
#include <fstream>
using namespace std;
ifstream fin("text.in");
ofstream fout("text.out");
string s;
int main()
{
long long sum=0,k=0,j=0;
char c;
while (fin.get(c))
{
if((c-'a'>=0 && c-'a'<=25) || (c-'A'>=0 && c-'A'<=25))j++;
else
{
if(j!=0)
{
k++;
sum+=j;
}
j=0;
}
}
if(j!=0)
{
k++;
sum+=j;
}
if(k!=0)
fout<<sum/k;
else
fout<<0;
return 0;
}