Pagini recente » Cod sursa (job #2288723) | Cod sursa (job #1855864) | Cod sursa (job #2515757) | Cod sursa (job #1113415) | Cod sursa (job #627735)
Cod sursa(job #627735)
#include <cstdio>
#define DN 1024*1025
using namespace std;
char x[DN];
int main()
{
int nrcuv=0,nrlitere=0;
freopen("text.in","r", stdin);
freopen("text.out","w", stdout);
fgets(x,1000005,stdin);
int j=1;
//for(int i=0;x[i]!=0;i++)
while(1)
{
if(x[j]==' ' || x[j]==',' || x[j]=='-') j++;
while((x[j]>='a' && x[j]<='z') || (x[j]>='A' && x[j]<='Z'))
{
nrlitere++;
j++;
}
if(x[j]=='-') j++;
while((x[j]>='a' && x[j]<='z') || (x[j]>='A' && x[j]<='Z'))
{
nrlitere++;
j++;
}
nrcuv++;
if(x[j]=='!' || x[j]=='?' || x[j]=='.') break;
}
printf("%d %d %d",nrlitere,nrcuv,nrlitere/nrcuv);
return 0;
}