Cod sursa(job #3369109)
| Utilizator | Data | 17 octombrie 2026 12:35:32 | |
|---|---|---|---|
| Problema | Text | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.52 kb |
#include <fstream>
std::ifstream fin("text.in");
std::ofstream fout("text.out");
bool estelitera(char C)
{
return (C<='z'&&C>='a')||(C<='Z'&&C>='A');
}
int main()
{
char C,LC='-';
int NrLitere=0;
int NrCuvinte = 0;
while ((C=fin.get())&&C!=EOF)
{
if (estelitera(C))
{
NrLitere++;
} else if (estelitera(LC))
{
NrCuvinte++;
}
LC=C;
}
if (estelitera(C)) NrCuvinte++;
fout << NrLitere/NrCuvinte;
}
