Cod sursa(job #1094045)
| Utilizator | Data | 28 ianuarie 2014 20:59:35 | |
|---|---|---|---|
| Problema | Text | Scor | 30 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.5 kb |
#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);
}
