Cod sursa(job #2441861)
Utilizator | Mihai Ionescu MihaIonescu | Data | 21 iulie 2019 16:11:46 |
---|---|---|---|
Problema | Text | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.55 kb |
#include <fstream>
#include <cstring>
using namespace std;
ifstream f ("text.in");
ofstream g ("text.out");
int main ()
{
long long l_tot = 0, nr_cuv = 0;
bool cuvant = false;
char c;
while (f.get(c))
{
if ((c>='a' && c<='z')||(c>='A' && c<='Z'))
{
l_tot++;
cuvant = true;
}
else
{
if (cuvant)
nr_cuv++;
cuvant = false;
}
}
if (cuvant)
nr_cuv++;
g<<l_tot/nr_cuv;
}