Pagini recente » Cod sursa (job #13005) | Cod sursa (job #2722732) | Cod sursa (job #3205868) | Cod sursa (job #1115942) | Cod sursa (job #739136)
Cod sursa(job #739136)
#include <cstdio>
using namespace std;
int main()
{
freopen("text.in","r",stdin);
freopen("text.out","w",stdout);
unsigned nc = 0,nl = 0;
char c,s;
scanf("%c",&c);
if(c == '-')
{
scanf("%c",&s);
nc = 1;
}
else
{
nc = 1;
nl = 1;
}
while(c != '!' && c != '.' && c != '?')
{
scanf("%c",&c);
if(c == ' ' || c == '-')
{
nc++;
}
if(c == ',')
{
scanf("%c",&s);
nc++;
}
if((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))
nl++;
}
printf("%d",nl/nc);
return 0;
}