Cod sursa(job #2074976)
Utilizator | Data | 25 noiembrie 2017 10:27:55 | |
---|---|---|---|
Problema | Text | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.38 kb |
#include <fstream>
#include <cstring>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
char s[256],*p,v[]=" ,.'!?-";
int nr,n;
int main()
{
f.get(s,256);
for(int i=0;i<strlen(s);i++)
if(isalpha(s[i]))
nr++;
p=strtok(s,v);
while(p)
{
n++;
p=strtok(NULL,v);
}
g<<nr/n;
return 0;
}