
#include<stdio.h>
#include<conio.h>

	char l[]={" .,!?(){};"};

int letter(char x)
{       int q=0,i=0;

	while(l[i]!=NULL) {q+=(l[i]==x);i++;}
	q+=((x==13)||(x==9)||(x==10));
	return q;}

void make(FILE *f1,FILE *fh)
{
	char buf[50],c,c1;long p;int i,z=0;

	fseek(fh,0,2);fgetpos(fh,&p);p--;

	while(p>-2)

    {	do{fseek(fh,p,0);p--;c=fgetc(fh);} while((p>-2)&&(letter(c)));

	i=0;
	while((p>-2)&&(!letter(c)))
	{buf[i]=c;i++;fseek(fh,p,0);p--;c=fgetc(fh);}
	z+=i+1;

	buf[i]=NULL;

	while(i>0){i--;fputc(buf[i],f1);}
	fputc('\n',f1);


				       } }

int main()
{
	FILE *fh,*f1;
	char fs[15],fd[15];

	printf("\n input name of destination file ");
	scanf("%s",fd);
	printf("\n input source file name ");
	scanf("%s",fs);

	fh=fopen(fs,"r+t");
	f1=fopen(fd,"w+t");

	make(f1,fh);

	fclose(fh);
	fclose(f1);

	return 1;}







