Cod sursa(job #1982392)
Utilizator | Data | 18 mai 2017 17:30:39 | |
---|---|---|---|
Problema | Text | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.54 kb |
#include <fstream>
using namespace std;
ifstream cin("text.in");
ofstream cout("text.out");
int main()
{
int sum=0,nr=0,ac=0;
char s;
while(int(s)!=10)
{
s=cin.get();
int x=int{s};
if(x>=65 and x<=90)
ac++;
else
if(x>=97 and x<=122)
ac++;
else
if(ac>0)
{
sum=sum+ac;
ac=0;
++nr;
}
}
cout<<sum/nr;
cin.close();
cout.close();
return 0;
}