Cod sursa(job #2022686)
| Utilizator | Data | 16 septembrie 2017 22:52:19 | |
|---|---|---|---|
| Problema | Text | Scor | 40 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.85 kb |
#include <fstream>
using namespace std;
ifstream cin("text.in");
ofstream cout("text.out");
bool f(char ch)
{
if('a'<=ch and ch<='z')
return 1;
if('A'<=ch and ch<='Z')
return 1;
return 0;
}
int main()
{
ios_base::sync_with_stdio(0);
long long sum=0,nr=0;
char ch;
while(1)
{
ch=cin.get();
if(ch=='\n')
{
cout<<sum/nr;
return 0;
}
if(f(ch))
{
nr++;
sum++;
while(1)
{
ch=cin.get();
if(ch=='\n')
{
cout<<sum/nr;
return 0;
}
if(f(ch)==0)
break;
sum++;
}
}
}
return 0;
}
