Cod sursa(job #1577428)
Utilizator | Data | 23 ianuarie 2016 14:02:45 | |
---|---|---|---|
Problema | Text | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.44 kb |
#include <iostream>
#include <fstream>
#include <string.h>
using namespace std;
int main()
{
ifstream f("text.in");
ofstream g("text.out");
char s[255], sep[]="., -:!?'1234567890", *p;
int nr=0, k=0, i;
f.getline(s,255);
for(i=0;i<strlen(s);i++)
{
if(strchr(sep,s[i])==0) nr++;
}
p=strtok(s,sep);
while(p)
{
k++;
p=strtok(NULL,sep);
}
g<<nr/k;
}