Cod sursa(job #2810146)
| Utilizator | Data | 28 noiembrie 2021 17:19:26 | |
|---|---|---|---|
| Problema | Text | Scor | 40 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.5 kb |
#include <fstream>
#include <cstring>
using namespace std;
ifstream cin("text.in");
ofstream cout("text.out");
char s[256];
int main() {
cin.getline(s, 256);
int litere = 0;
int cuvinte = 0;
for (int i = 0; s[i]; ++i) {
if (strchr("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", s[i]) != NULL)
litere++;
else if (strchr("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", s[i]) == NULL && s[i + 1] != ' ')
cuvinte++;
}
cout << litere / cuvinte;
return 0;
}