Cod sursa(job #2068877)
Utilizator | Data | 18 noiembrie 2017 11:31:25 | |
---|---|---|---|
Problema | Text | Scor | 40 |
Compilator | cpp | Status | done |
Runda | evaluare_cex_sv_cls_x | Marime | 0.44 kb |
#include <iostream>
#include <fstream>
#include <cstring>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
int main()
{
char s[500],*p;
int i,n,nrl=0,nrc=0;
f.getline(s,500);
n=strlen(s);
for (i=0;i<n;i++)
if (isalpha(s[i]))
nrl++;
p=strtok(s," -,!?.;:");
while (p)
{
nrc++;
p=strtok(NULL," -,!?.;:");
}
g<<nrl/nrc;
return 0;
}