Pagini recente » Diferente pentru problema/permutare2 intre reviziile 4 si 3 | Monitorul de evaluare | Cod sursa (job #2414757) | Cod sursa (job #2626276) | Cod sursa (job #1259727)
#include<stdio.h>
#include<string.h>
int main()
{
FILE *input, *output;
input = fopen ("text.in", "rt");
output = fopen ("text.out", "wt");
char text[9999];
int i;
int ChrCounter = 0;
int WrdCounter = 0;
fscanf(input, "%[^\n]c", text);
for (i=0; i<strlen(text); i++)
{
if ( (text[i] >= 'a' && text[i] <= 'z') || (text[i] >= 'A' && text[i] <= 'Z') )
{
ChrCounter++;
if ( !(text[i+1] >= 'a' && text[i+1] <= 'z') && !(text[i+1] >= 'A' && text[i+1] <= 'Z') )
WrdCounter++;
}
}
fprintf(output, "%d" , ChrCounter/WrdCounter);
}