Pagini recente » Cod sursa (job #2562584) | Cod sursa (job #3316523) | Cod sursa (job #3350990) | Cod sursa (job #1905085) | Cod sursa (job #3320660)
#include <iostream>
#include <cstring>
#include <fstream>
using namespace std;
ifstream fin("text.in");
ofstream fout("text.out");
int main()
{
char a[1001];
int n = 0, i, contor = 0, litere = 0;
fin.get(a, 1001);
n=strlen(a);
bool in_cuvant = false;
int lungime_cuvant = 0;
for (i=0; i<n; i++)
{
if (strchr("ABCDEFGHIJKLMNOPQRSTUVWXYZĂÂÎȘȚabcdefghijklmnopqrstuvwxyzăâîșț", a[i]))
{
in_cuvant = true;
lungime_cuvant++;
}
else
{
if (in_cuvant)
{
contor++;
litere+=lungime_cuvant;
lungime_cuvant=0;
in_cuvant=false;
}
}
}
if (in_cuvant)
{
contor++;
litere+=lungime_cuvant;
}
if (contor == 0)
fout << 0;
else
fout << litere / contor;
}