Pagini recente » Cod sursa (job #32631) | Cod sursa (job #3287507) | Cod sursa (job #920074) | Cod sursa (job #798784) | Cod sursa (job #1361398)
#include <fstream>
#include <string.h>
#define NMax 100000
using namespace std;
ifstream in ("text.in");
ofstream out ("text.out");
char text[NMax];long long lungime,nr_cuvinte,aux;
int main()
{
in.getline(text,NMax);
if ((text[0]>=65&&text[0]<=90)||(text[0]>=97&&text[0]<=122))
lungime++;
for (int i=1;i<strlen(text);i++)
{
if (((text[i-1]>=65&&text[i-1]<=90)||(text[i-1]>=97&&text[i-1]<=122))&&(text[i]<65||(text[i]>90&&text[i]<97)||text[i]>122))
nr_cuvinte++;
else if ((text[i]>=65&&text[i]<=90)||(text[i]>=97&&text[i]<=122))
lungime++;
}
out<<lungime/nr_cuvinte;
return 0;
}