Mai intai trebuie sa te autentifici.
Cod sursa(job #850696)
Utilizator | Data | 8 ianuarie 2013 19:56:37 | |
---|---|---|---|
Problema | Text | Scor | 30 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.62 kb |
#include<string.h>
#include<iostream>
#include<fstream>
using namespace std;
int main()
{
int i,k,nr=0,cuv=0;
char s[10000],*p;
fstream f("text.in",ios::in);
fstream g("text.out",ios::out);
f.getline(s,10000);
strcat(s," ");
p=strtok(s," ,;!?=");
//cout<<p;
while(p)
{
if(*p!='-'){
k=strlen(p);
i=0;
while(i<k){
if(*(p+i)!='-')
nr++;
else
cuv++;
i++;
}
cuv++;}
p=strtok(NULL," ,;!?=");
}
g<<nr/cuv;
f.close();
g.close();
}