Pagini recente » Cod sursa (job #1826417) | Cod sursa (job #974099) | Cod sursa (job #1135668) | Cod sursa (job #726420) | Cod sursa (job #93478)
Cod sursa(job #93478)
#include <fstream.h>
#include <string.h>
#include <iomanip.h>
ifstream fin("text.in");
ofstream fout("text.out");
int str_len(char text[])
{
int c=0, i;
int s;
s = strlen(text);
for (i=0; i < s; i++)
if (text[i]>='a' && text[i]<='z' || text[i]>='A' && text[i]<='Z') c++;
return c;
}
int cuvinte (char text[])
{
int cuv = 0;
int s;
s = strlen(text);
for (int i=0; i < s; i++)
if (text[i] == ' ') cuv++;
return cuv;
}
int main()
{
char text[200];
int l, cuv, t;
int i=0;
while (!fin.eof())
{
fin>>resetiosflags(ios::skipws)>>text[i];
i++;
}
l = str_len(text);
cuv = cuvinte(text)+1;
t = l/cuv;
fout<<t<<'\n';
return 0;
}