Cod sursa(job #41718)
Utilizator | Data | 28 martie 2007 15:09:33 | |
---|---|---|---|
Problema | Text | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.51 kb |
#include <iostream.h>
#include <fstream.h>
#include <string.h>
ifstream f ("text.in");
ofstream g ("text.out");
int nr(char a[100])
{
int i,n=strlen(a);
for(i=0;i<strlen(a);i++)
if(a[i]==' ' || a[i]=='.' || a[i]==',') n--;
return n;
}
int main()
{
char a[100],sep[20]=" -,./;",*p;
int i,nr=0,x,n;
f>>a;
p=strtok(a,sep);
while(p!=NULL)
{
nr++;
p=strtok(NULL,sep);
}
n=nr(a);
x=n/nr;
g<<x;
return 0;
}