Cod sursa(job #1820342)
| Utilizator | Data | 1 decembrie 2016 16:40:47 | |
|---|---|---|---|
| Problema | Text | Scor | 40 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.55 kb |
#include <fstream>
#include <iostream>
using namespace std;
string s;
bool ch(char x)
{
if ( ((x>='a') && (x<='z')) || ((x<='Z') && (x>='A')) ) return true;
return false;
}
main()
{
ifstream fin("text.in");
getline(fin,s);
fin.close();
int w=0,c=0,q=0; char x;
for (int i=0; i<s.size(); i++)
{
x=s[i];
if (ch(x)) c++; else
{
q+=c;
if (c!=0) w++;
c=0;
}
}
ofstream fout("text.out");
fout<<q/w;
fout.close();
}
