Cod sursa(job #2633639)
| Utilizator | Data | 8 iulie 2020 01:01:24 | |
|---|---|---|---|
| Problema | Text | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.47 kb |
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
ifstream fin("text.in");
ofstream fout("text.out");
int main() {
int nrCuvinte = 0,nrLitere = 0;
char ch;
bool anyLetter = 0;
while(fin.get(ch)) {
if (isalpha(ch)) {
nrLitere++;
anyLetter = 1;
}
else
{
if (anyLetter == 1)
{
anyLetter = 0;
nrCuvinte++;
}
}
}
int x = nrLitere / nrCuvinte;
fout << x;
return 0;
}