Pagini recente » Statistici Natarau Alexandru Lilian 321CA (Natarau_Alexandru_Lilian_321CA) | Monitorul de evaluare | Cod sursa (job #1042783) | Cod sursa (job #2553500)
#include <fstream>
#include <iostream>
using namespace std;
ifstream in("text.in");
ofstream out("text.out");
#define forbiddenCharSize 6
char forbiddenChars[forbiddenCharSize] = {'-', '.', '_', ',', '!', '?'};
int main()
{
int total_Len = 0;
int total_cuv = 0;
string temp;
while (in >> temp)
{
int size = temp.length();
bool isWord = true;
for (int i = 0; i < forbiddenCharSize; i++)
{
if (temp.find(forbiddenChars[i]) != string::npos)
{
isWord = false;
break;
}
}
if (isWord)
{
total_Len = total_Len + size;
total_cuv++;
}
}
out << (int)(total_Len / total_cuv);
in.close();
out.close();
return 0;
}