Pagini recente » Cod sursa (job #2186671) | Cod sursa (job #1850064) | Cod sursa (job #1803805) | Cod sursa (job #2511248) | Cod sursa (job #1478826)
#include <iostream>
#include <fstream>
#include <string>
#include <algorithm>
#include <cstring>
using namespace std;
ifstream in("text.in");
ofstream out("text.out");
char *s;
int l;
string special = "";
int contor;
int cuvinte;
void citire()
{
in.seekg(0,in.end);
l = in.tellg();
s = new char[l];
cout << l;
in.seekg(0,in.beg);
in.read(s,l);
}
void solve()
{
int cuvm=0;
for(int i=0;i<l;i++)
{
if((s[i]>='a' && s[i]<='z') || (s[i]>='A' && s[i]<='Z'))
{
contor++;
cuvm++;
}
else
{
if(cuvm > 0)
{
cuvm = 0;
cuvinte++;
}
}
}
if(cuvm > 0)
cuvinte++;
}
int main()
{
citire();
solve();
//cout << "cuvinte: " << cuvinte << endl;
//cout << contor;
if(cuvinte!=0)
out << contor / cuvinte;
else
out << 0;
return 0;
}