Pagini recente » Cod sursa (job #1790729) | Cod sursa (job #1085492) | Cod sursa (job #2846637) | Cod sursa (job #1763502) | Cod sursa (job #1094045)
#include <fstream>
#include <string.h>
#include <iostream>
#define lmax 1000000
using namespace std;
int noWords(char t[])
{
int contor = 1;
char *p = strchr(t, ' ');
while(p)
{
p = strchr(p+1, ' ');
contor++;
}
return contor;
}
int main()
{
ifstream f("text.in");
ofstream g("text.out");
char t[lmax];
int l, l1;
f.get(t, lmax);
l = strlen(t);
l1 = l - noWords(t) - 1;
g << l1/noWords(t);
}