Cod sursa(job #3036468)
Utilizator | Candidatu Mario Luca dragoncrack | Data | 24 martie 2023 13:12:20 |
---|---|---|---|
Problema | Text | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.72 kb |
#include <fstream>
#include <cstring>
using namespace std;
ifstream fin ("text.in");
ofstream fout("text.out");
int litere, cuvinte;
char cuvant[1200005];
int main()
{
while(fin >> cuvant)
{
bool cuvantNou = true;
int limita = strlen(cuvant);
for(int i = 0; i < limita; i++)
{
if((cuvant[i] >= 'a' && cuvant[i] <= 'z') || (cuvant[i] >= 'A' && cuvant[i] <= 'Z'))
{
if(cuvantNou)
{
cuvantNou = false;
cuvinte++;
}
litere++;
}
else
cuvantNou = true;
}
}
fout << litere / cuvinte;
}