Pagini recente » Cod sursa (job #228494) | Cod sursa (job #2982234) | Cod sursa (job #2265473) | Cod sursa (job #2642865) | Cod sursa (job #1349182)
//============================================================================
// Name : Text.cpp
// Author : Andrei
// Version :
// Copyright : Your copyright notice
// Description : Text - InfoArena
//============================================================================
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
using namespace std;
int main() {
FILE *in = fopen("text.in", "r");
FILE *out = fopen("text.out", "w");
int w = 0;
int l = 0;
char c;
while (!feof(in)) {
c = fgetc(in);
if (('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z')) {
w++;
while (!feof(in)
&& (('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z'))) {
l++;
c = fgetc(in);
}
}
}
int r = l / w;
fprintf(out, "%d", r);
fclose(in);
fclose(out);
return 0;
}