Cod sursa(job #1199243)
| Utilizator | Data | 18 iunie 2014 17:34:28 | |
|---|---|---|---|
| Problema | Text | Scor | 50 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.53 kb |
#include <fstream>
#include <cstring>
#include <cctype>
using namespace std;
ifstream fin("text.in");
ofstream fout("text.out");
char s[10000];
char sep[] = " -.,!?";
int lit, cuv;
int main()
{
fin.getline(s, 10001, EOF);
int n = strlen(s);
for ( int i = 0; i < n; ++i )
if ( isalpha(s[i]) ) lit++;
char* p = strtok(s, sep);
while (p)
{
cuv++;
p = strtok(NULL, sep);
}
fout << lit / (cuv - 1);
fin.close();
fout.close();
return 0;
}
