Cod sursa(job #798921)
| Utilizator | Data | 17 octombrie 2012 16:24:22 | |
|---|---|---|---|
| Problema | Text | Scor | 40 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.45 kb |
#include<fstream>
#include<string>
using namespace std;
string s;
int ok,i,nr,p;
bool litera(char x)
{
if ((('a'<=x) && (x<='z')) || (('A'<=x) && (x<='Z')))
return true;
else return false;
}
int main()
{
ifstream f("text.in");
ofstream g("text.out");
getline(f,s);ok=0;
for (i=0;i<s.size();i++)
{
if (litera(s[i]))
{
if (ok==0)
{
nr++;
ok=1;
}
p++;
}
else ok=0;
}
g << p/nr;
}
