//	This source and text sequencing method apply to GNU General Public License. 
//			Copyright (C) 2003  Jasenko Dzinleski 

//	This source applies to the GNU General Public License as
//	published by the Free Software Foundation 
//	and can not be used, copied, sold, redistributed or 
//	used in any other way but only by written permission by Jasenko Dzinleski . 
//	Copyright (C) from 2003 - 2014 and later by Jasenko Dzinleski 

//	This program is distributed in the hope that it will be useful, but
//	WITHOUT ANY WARRANTY; without even the implied warranty of
//	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
//	General Public License for more details. 

//	You should have received a copy of the GNU General Public License along
//	with this program; if not, write to the Free Software Foundation, Inc.,
//	51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

//
//		text sequencing
//		written by Dzinleski Jasenko  2003 - 26 , April , 2014
//


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

FILE		*f1,*f2,*f3,*f11;

char		infn[256]="fasta_p1.txt";
//char		infn[256]="War_and_Peace_NT.txt";

char		out1fn[256]="out1.txt";
char		out2fn[256]="out2.txt";
char		out3fn[256]="out3.txt";
char		out4fn[256]="out4.txt";

int 		ba2b[256][256][256][2];	int ba2bi=0;
int 		bab[256][2][50000];	int babi=0;
int 		bab_[256][50000];	int babi_=0;

char		ca[3*8*1024];		int cai=0;

long		v[10][10];
char		vc[10][10][10];

//

char		csv[256];		int csvi=0;

char		cv[256];int cvi=0;
char		nl[256];int nli=0;

//
char		sv1_[256];
char		sv2_[256];
char		sv3_[256];
char		sv4_[256];
char		sv5_[256];
char		sv6_[256];
char		sv7_[256];
char		sv8_[256];

int		c1,c2,c3,c4,c5,c6,c7,c8,c9;
int		c1_,c2_,c3_,c4_,c5_,c6_,c7_,c8_,c9_;
//


int p_1(char sv1[256],char sv2[256],char sv3[256],char sv4[256],char sv5[256],char sv6[256],char sv7[256],char sv8[256])
{

int sv1i=strlen(sv1);
int sv2i=strlen(sv2);
int sv3i=strlen(sv3);
int sv4i=strlen(sv4);
int sv5i=strlen(sv5);
int sv6i=strlen(sv6);
int sv7i=strlen(sv7);
int sv8i=strlen(sv8);

int	a,b,d,e;
int	i,j,k,l,m,n;
int	fb;
int	nc=1;

	c1_=0;c2_=0;c3_=0;c4_=0;c5_=0;c6_=0;c7_=0;c8_=0;c9_=0;
	f11=fopen(infn,"rb");
	fb=getc(f11);
	while(!feof(f11))
	{
		cvi=0;while((fb!=10)&&(fb!=13)){cv[cvi]=fb;++cvi;fb=getc(f11);}
		if(nli==0){while((fb==10)||(fb==13)){nl[nli]=fb;++nli;fb=getc(f11);}}else{
			j=0;while((fb==10)||(fb==13)){if(nl[j]==fb){++j;if(j==nli){j=0;++nc;}}fb=getc(f11);}
		}

		//printf("%s\n",cv);

		c1=0;for(i=0;i<256;++i){csv[i]='\0';}csvi=0;
		for(k=0;k<cvi;++k)
		{
			m=0;for(j=0;j<strlen(sv1);++j){if(sv1[j]!='_'){if(sv1[j]!=cv[j+k]){break;}else{++m;csv[csvi]=cv[j+k];++csvi;}}else{++m;csv[csvi]=cv[j+k];++csvi;}}
			if(strlen(csv)==strlen(sv1)){++c1;/*break;*/}
			for(i=0;i<256;++i){csv[i]='\0';}csvi=0;
		}

		c2=0;for(i=0;i<256;++i){csv[i]='\0';}csvi=0;
		for(k=0;k<cvi;++k)
		{
			m=0;for(j=0;j<strlen(sv2);++j){if(sv2[j]!='_'){if(sv2[j]!=cv[j+k]){break;}else{++m;csv[csvi]=cv[j+k];++csvi;}}else{++m;csv[csvi]=cv[j+k];++csvi;}}
			if(strlen(csv)==strlen(sv2)){++c2;/*break;*/}
			for(i=0;i<256;++i){csv[i]='\0';}csvi=0;
		}

		c3=0;for(i=0;i<256;++i){csv[i]='\0';}csvi=0;
		for(k=0;k<cvi;++k)
		{
			m=0;for(j=0;j<strlen(sv3);++j){if(sv3[j]!='_'){if(sv3[j]!=cv[j+k]){break;}else{++m;csv[csvi]=cv[j+k];++csvi;}}else{++m;csv[csvi]=cv[j+k];++csvi;}}
			if(strlen(csv)==strlen(sv3)){++c3;/*break;*/}
			for(i=0;i<256;++i){csv[i]='\0';}csvi=0;
		}

		c4=0;for(i=0;i<256;++i){csv[i]='\0';}csvi=0;
		for(k=0;k<cvi;++k)
		{
			m=0;for(j=0;j<strlen(sv4);++j){if(sv4[j]!='_'){if(sv4[j]!=cv[j+k]){break;}else{++m;csv[csvi]=cv[j+k];++csvi;}}else{++m;csv[csvi]=cv[j+k];++csvi;}}
			if(strlen(csv)==strlen(sv4)){++c4;/*break;*/}
			for(i=0;i<256;++i){csv[i]='\0';}csvi=0;
		}

		c5=0;for(i=0;i<256;++i){csv[i]='\0';}csvi=0;
		for(k=0;k<cvi;++k)
		{
			m=0;for(j=0;j<strlen(sv5);++j){if(sv5[j]!='_'){if(sv5[j]!=cv[j+k]){break;}else{++m;csv[csvi]=cv[j+k];++csvi;}}else{++m;csv[csvi]=cv[j+k];++csvi;}}
			if(strlen(csv)==strlen(sv5)){++c5;/*break;*/}
			for(i=0;i<256;++i){csv[i]='\0';}csvi=0;
		}

		c6=0;for(i=0;i<256;++i){csv[i]='\0';}csvi=0;
		for(k=0;k<cvi;++k)
		{
			m=0;for(j=0;j<strlen(sv6);++j){if(sv6[j]!='_'){if(sv6[j]!=cv[j+k]){break;}else{++m;csv[csvi]=cv[j+k];++csvi;}}else{++m;csv[csvi]=cv[j+k];++csvi;}}
			if(strlen(csv)==strlen(sv6)){++c6;/*break;*/}
			for(i=0;i<256;++i){csv[i]='\0';}csvi=0;
		}

		c7=0;for(i=0;i<256;++i){csv[i]='\0';}csvi=0;
		for(k=0;k<cvi;++k)
		{
			m=0;for(j=0;j<strlen(sv7);++j){if(sv7[j]!='_'){if(sv7[j]!=cv[j+k]){break;}else{++m;csv[csvi]=cv[j+k];++csvi;}}else{++m;csv[csvi]=cv[j+k];++csvi;}}
			if(strlen(csv)==strlen(sv7)){++c7;/*break;*/}
			for(i=0;i<256;++i){csv[i]='\0';}csvi=0;
		}

		c8=0;for(i=0;i<256;++i){csv[i]='\0';}csvi=0;
		for(k=0;k<cvi;++k)
		{
			m=0;for(j=0;j<strlen(sv8);++j){if(sv8[j]!='_'){if(sv8[j]!=cv[j+k]){break;}else{++m;csv[csvi]=cv[j+k];++csvi;}}else{++m;csv[csvi]=cv[j+k];++csvi;}}
			if(strlen(csv)==strlen(sv8)){++c8;/*break;*/}
			for(i=0;i<256;++i){csv[i]='\0';}csvi=0;
		}

		if(c1>=1||c2>=1||c3>=1||c4>=1||c5>=1||c6>=1||c7>=1||c8>=1)
		{
			c1_+=c1;c2_+=c2;c3_+=c3;c4_+=c4;c5_+=c5;c6_+=c6;c7_+=c7;c8_+=c8;if(c1>=1&&c2>=1&&c3>=1&&c4>=1&&c5>=1&&c6>=1&&c7>=1&&c8>=1){++c9_;}
			/*
			printf("%02d%02d%02d%02d%02d%02d%02d%02d\t",c1,c2,c3,c4,c5,c6,c7,c8);
			for(j=0;j<cvi;++j){printf("%c",cv[j]);}
			printf("\t%s\t%s",csv,sv1);printf("\t%d\n",nc);
			*/
		}
	}
	fclose(f11);
	return(0);

}

int main(int argc,char *argv[])
{

int	a,b,c,d,e;
int	i,j,k,l,m,n;
int	b1_,b2_,b3_,b4_,b5_;
int	b1,b2,b3,b4;

	for(i=0;i<256;++i){
	for(j=0;j<256;++j){
	for(k=0;k<256;++k){
		ba2b[i][j][k][0]=-1;
	}}}ba2bi=0;

	for(i=0;i<256;++i){
	for(j=0;j<50000;++j){
		bab[i][0][j]=-1;
		bab[i][1][j]=0;
	}}babi=0;

	for(i=0;i<256;++i){
	for(j=0;j<50000;++j){
		bab_[i][j]=0;
	}}babi_=0;

	f1=fopen(infn,"rb");

	b1_=getc(f1);
	b2_=getc(f1);
	b3_=getc(f1);
	b4_=getc(f1);
	b5_=getc(f1);

	while(!feof(f1))
	{

	if(
	ba2b[(b1_&0xff)][(b2_&0xff)][(b3_&0xff)][0]==-1
	)
	{
	ba2b[(b1_&0xff)][(b2_&0xff)][(b3_&0xff)][0]=ba2bi;	
	if(bab[(b4_&0xff)][0][ba2b[(b1_&0xff)][(b2_&0xff)][(b3_&0xff)][0]]==-1)
	{
	bab[(b4_&0xff)][0][ba2b[(b1_&0xff)][(b2_&0xff)][(b3_&0xff)][0]]=babi;
	++bab_[(b5_&0xff)][babi];
	++babi;
	++bab[(b4_&0xff)][1][ba2b[(b1_&0xff)][(b2_&0xff)][(b3_&0xff)][0]];
	}else{++bab[(b4_&0xff)][1][ba2b[(b1_&0xff)][(b2_&0xff)][(b3_&0xff)][0]];++bab_[(b5_&0xff)][bab[(b4_&0xff)][0][ba2b[(b1_&0xff)][(b2_&0xff)][(b3_&0xff)][0]]];}
	++ba2bi;
	ba2b[(b1_&0xff)][(b2_&0xff)][(b3_&0xff)][1]=1;
	}else{
	++ba2b[(b1_&0xff)][(b2_&0xff)][(b3_&0xff)][1];
	if(bab[(b4_&0xff)][0][ba2b[(b1_&0xff)][(b2_&0xff)][(b3_&0xff)][0]]==-1)
	{
	bab[(b4_&0xff)][0][ba2b[(b1_&0xff)][(b2_&0xff)][(b3_&0xff)][0]]=babi;
	++bab_[(b5_&0xff)][babi];
	++babi;
	++bab[(b4_&0xff)][1][ba2b[(b1_&0xff)][(b2_&0xff)][(b3_&0xff)][0]];
	}else{++bab[(b4_&0xff)][1][ba2b[(b1_&0xff)][(b2_&0xff)][(b3_&0xff)][0]];++bab_[(b5_&0xff)][bab[(b4_&0xff)][0][ba2b[(b1_&0xff)][(b2_&0xff)][(b3_&0xff)][0]]];}
	}

	b1_=b2_;
	b2_=b3_;
	b3_=b4_;
	b4_=b5_;
	b5_=getc(f1);

	}
	fclose(f1);

	f2=fopen(out1fn,"wb");

	for(i=0;i<256;++i){
	if((char)i==' '||i==13||i==10){continue;}
	for(j=0;j<256;++j){
	if((char)j==' '||j==13||j==10){continue;}
	for(k=0;k<256;++k){
	if((char)k==' '||k==13||k==10){continue;}
	if(ba2b[i][j][k][0]!=-1)
	{
	fprintf(f2,"%d\t%c%c%c\t",ba2b[i][j][k][1],i,j,k);
	for(l=0;l<256;++l){
	if((char)l==' '||l==13||l==10){continue;}
	if(bab[l][1][ba2b[i][j][k][0]]>=1){fprintf(f2,"%c\t%d\t",l,bab[l][1][ba2b[i][j][k][0]]);}}fprintf(f2,"\n");
	}}}}

	fprintf(f2,"\n");
	fprintf(f2,"\n");

	for(i=0;i<256;++i){
	if((char)i==' '||i==13||i==10){continue;}
	for(j=0;j<256;++j){
	if((char)j==' '||j==13||j==10){continue;}
	for(k=0;k<256;++k){
	if((char)k==' '||k==13||k==10){continue;}
	if(ba2b[i][j][k][0]!=-1)
	{
	fprintf(f2,"%d\t%c%c%c\t",ba2b[i][j][k][1],i,j,k);
	for(l=0;l<256;++l){
	if((char)l==' '||l==13||l==10){continue;}
	if(bab[l][1][ba2b[i][j][k][0]]>=1)
	{
		fprintf(f2,"%c\t%d\t",l,bab[l][1][ba2b[i][j][k][0]]);
		for(m=0;m<256;++m){
		if((char)m==' '||m==13||m==10){continue;}
		if(bab_[m][bab[l][0][ba2b[i][j][k][0]]]>=1)
		{
		fprintf(f2,"%c%c\t%d\t",l,m,bab_[m][bab[l][0][ba2b[i][j][k][0]]]);
		}
		}
	}
	}
	fprintf(f2,"\n");
	}}}}
	fclose(f2);
	//printf("ok\n");

	f1=fopen(infn,"rb");

	for(i=0;i<256;++i){sv1_[i]='\0';}
	for(i=0;i<256;++i){sv2_[i]='\0';}
	for(i=0;i<256;++i){sv3_[i]='\0';}
	for(i=0;i<256;++i){sv4_[i]='\0';}
	for(i=0;i<256;++i){sv5_[i]='\0';}
	for(i=0;i<256;++i){sv6_[i]='\0';}
	for(i=0;i<256;++i){sv7_[i]='\0';}
	for(i=0;i<256;++i){sv8_[i]='\0';}

	b1_=getc(f1);while(((char)b1_==' '||b1_==13||b1_==10)){b1_=getc(f1);}ca[cai]=b1_;++cai;
	b1_=getc(f1);while(((char)b1_==' '||b1_==13||b1_==10)){b1_=getc(f1);}ca[cai]=b1_;++cai;
	b1_=getc(f1);while(((char)b1_==' '||b1_==13||b1_==10)){b1_=getc(f1);}ca[cai]=b1_;++cai;

	b1_=getc(f1);while(((char)b1_==' '||b1_==13||b1_==10)){b1_=getc(f1);}ca[cai]=b1_;++cai;
	b1_=getc(f1);while(((char)b1_==' '||b1_==13||b1_==10)){b1_=getc(f1);}ca[cai]=b1_;++cai;
	b1_=getc(f1);while(((char)b1_==' '||b1_==13||b1_==10)){b1_=getc(f1);}ca[cai]=b1_;++cai;

	b1_=getc(f1);while(((char)b1_==' '||b1_==13||b1_==10)){b1_=getc(f1);}ca[cai]=b1_;++cai;
	b1_=getc(f1);while(((char)b1_==' '||b1_==13||b1_==10)){b1_=getc(f1);}ca[cai]=b1_;++cai;
	b1_=getc(f1);while(((char)b1_==' '||b1_==13||b1_==10)){b1_=getc(f1);}ca[cai]=b1_;++cai;

	while(!feof(f1))
	{

	b1_=getc(f1);while(((char)b1_==' '||b1_==13||b1_==10)){b1_=getc(f1);}ca[cai]=b1_;++cai;

	if(cai>=3*8*1024)
	{

	for(n=0;n<3*8*1024;++n)
	{

	m=0;
	for(i=0;i<256;++i){sv1_[i]='\0';}
	for(l=n;l<n+(3*8);l+=3)
	{

	//
	v[m][0]=ba2b[ca[l+0]][ca[l+1]][ca[l+2]][1];
	vc[m][0][0]=ca[l+0];
	vc[m][0][1]=ca[l+1];
	vc[m][0][2]=ca[l+2];

	//
	v[m][1]=-1;	
	for(i=0;i<256;++i)
	{
	if(ba2b[i][ca[l+1]][ca[l+2]][0]!=-1)
	{
	if(v[m][1]==-1)
	{
		v[m][1]=ba2b[i][ca[l+1]][ca[l+2]][1];
		vc[m][1][0]=i;
		vc[m][1][1]=ca[l+1];
		vc[m][1][2]=ca[l+2];
	}else{
		if(v[m][1]<ba2b[i][ca[l+1]][ca[l+2]][1])
		{
			v[m][1]=ba2b[i][ca[l+1]][ca[l+2]][1];
			vc[m][1][0]=i;
			vc[m][1][1]=ca[l+1];
			vc[m][1][2]=ca[l+2];
		}
	}
	}
	}
	//
	v[m][2]=-1;	
	for(i=0;i<256;++i)
	{
	if(ba2b[ca[l+0]][i][ca[l+2]][0]!=-1)
	{
	if(v[m][2]==-1)
	{
		v[m][2]=ba2b[ca[l+0]][i][ca[l+2]][1];
		vc[m][2][0]=ca[l+0];
		vc[m][2][1]=i;
		vc[m][2][2]=ca[l+2];
	}else{
		if(v[m][2]<ba2b[ca[l+0]][i][ca[l+2]][1])
		{
			v[m][2]=ba2b[ca[l+0]][i][ca[l+2]][1];
			vc[m][2][0]=ca[l+0];
			vc[m][2][1]=i;
			vc[m][2][2]=ca[l+2];
		}
	}
	}
	}
	//
	v[m][3]=-1;	
	for(i=0;i<256;++i)
	{
	if(ba2b[ca[l+0]][ca[l+1]][i][0]!=-1)
	{
	if(v[m][3]==-1)
	{
		v[m][3]=ba2b[ca[l+0]][ca[l+1]][i][1];
		vc[m][3][0]=ca[l+0];
		vc[m][3][1]=ca[l+1];
		vc[m][3][2]=i;
	}else{
		if(v[m][3]<ba2b[ca[l+0]][ca[l+1]][i][1])
		{
			v[m][3]=ba2b[ca[l+0]][ca[l+1]][i][1];
			vc[m][3][0]=ca[l+0];
			vc[m][3][1]=ca[l+1];
			vc[m][3][2]=i;
		}
	}
	}
	}
	//
	//if(v[m][0]!=-1&&v[m][1]!=-1&&v[m][2]!=-1&&v[m][3]!=-1){++m;}
	++m;
	if(m>=8)
	{

	i=0;
	/*	
	printf("%d-- |%c%c%c|\n",i,vc[i][0][0],vc[i][0][1],vc[i][0][2]);
	printf("%d-1 |%c%c%c|\n",i,vc[i][1][0],vc[i][1][1],vc[i][1][2]);
	printf("%d-1 |%c%c%c|\n",i,vc[i][2][0],vc[i][2][1],vc[i][2][2]);
	printf("%d-1 |%c%c%c|\n",i,vc[i][3][0],vc[i][3][1],vc[i][3][2]);
	*/
	if(v[i][1]>v[i][2]&&v[i][1]>v[i][3])
	{sv1_[i*3+0]='_';sv1_[i*3+1]=vc[i][1][1];sv1_[i*3+2]=vc[i][1][2];}
	if(v[i][2]>v[i][1]&&v[i][2]>v[i][3])
	{sv1_[i*3+1]='_';sv1_[i*3+0]=vc[i][2][0];sv1_[i*3+2]=vc[i][2][2];}
	if(v[i][3]>v[i][1]&&v[i][3]>v[i][2])
	{sv1_[i*3+2]='_';sv1_[i*3+0]=vc[i][2][0];sv1_[i*3+1]=vc[i][2][1];}

	++i;
	/*
	printf("%d-- |%c%c%c|\n",i,vc[i][0][0],vc[i][0][1],vc[i][0][2]);
	printf("%d-2 |%c%c%c|\n",i,vc[i][1][0],vc[i][1][1],vc[i][1][2]);
	printf("%d-2 |%c%c%c|\n",i,vc[i][2][0],vc[i][2][1],vc[i][2][2]);
	printf("%d-2 |%c%c%c|\n",i,vc[i][3][0],vc[i][3][1],vc[i][3][2]);
	*/
	if(v[i][1]>v[i][2]&&v[i][1]>v[i][3])
	{sv1_[i*3+0]='_';sv1_[i*3+1]=vc[i][1][1];sv1_[i*3+2]=vc[i][1][2];}
	if(v[i][2]>v[i][1]&&v[i][2]>v[i][3])
	{sv1_[i*3+1]='_';sv1_[i*3+0]=vc[i][2][0];sv1_[i*3+2]=vc[i][2][2];}
	if(v[i][3]>v[i][1]&&v[i][3]>v[i][2])
	{sv1_[i*3+2]='_';sv1_[i*3+0]=vc[i][2][0];sv1_[i*3+1]=vc[i][2][1];}

	++i;
	/*
	printf("%d-- |%c%c%c|\n",i,vc[i][0][0],vc[i][0][1],vc[i][0][2]);
	printf("%d-3 |%c%c%c|\n",i,vc[i][1][0],vc[i][1][1],vc[i][1][2]);
	printf("%d-3 |%c%c%c|\n",i,vc[i][2][0],vc[i][2][1],vc[i][2][2]);
	printf("%d-3 |%c%c%c|\n",i,vc[i][3][0],vc[i][3][1],vc[i][3][2]);
	*/
	if(v[i][1]>v[i][2]&&v[i][1]>v[i][3])
	{sv1_[i*3+0]='_';sv1_[i*3+1]=vc[i][1][1];sv1_[i*3+2]=vc[i][1][2];}
	if(v[i][2]>v[i][1]&&v[i][2]>v[i][3])
	{sv1_[i*3+1]='_';sv1_[i*3+0]=vc[i][2][0];sv1_[i*3+2]=vc[i][2][2];}
	if(v[i][3]>v[i][1]&&v[i][3]>v[i][2])
	{sv1_[i*3+2]='_';sv1_[i*3+0]=vc[i][2][0];sv1_[i*3+1]=vc[i][2][1];}
	
	m=0;
	}

	if(strlen(sv1_)==9)
	{
	if(strlen(sv1_)&&!strlen(sv2_))
	{
	for(i=0;i<256;++i){sv2_[i]=sv1_[i];}
	for(i=0;i<256;++i){sv1_[i]='\0';}
	//printf("sv2_ %s\n",sv2_);
	}
	if(strlen(sv1_)&&strlen(sv2_)&&!strlen(sv3_))
	{
	for(i=0;i<256;++i){sv3_[i]=sv1_[i];}
	for(i=0;i<256;++i){sv1_[i]='\0';}
	//printf("sv3_ %s\n",sv3_);
	}
	if(strlen(sv1_)&&strlen(sv2_)&&strlen(sv3_)&&!strlen(sv4_))
	{
	for(i=0;i<256;++i){sv4_[i]=sv1_[i];}
	for(i=0;i<256;++i){sv1_[i]='\0';}
	//printf("sv4_ %s\n",sv4_);
	}
	if(strlen(sv1_)&&strlen(sv2_)&&strlen(sv3_)&&strlen(sv4_)&&!strlen(sv5_))
	{
	for(i=0;i<256;++i){sv5_[i]=sv1_[i];}
	for(i=0;i<256;++i){sv1_[i]='\0';}
	//printf("sv4_ %s\n",sv5_);
	}
	if(strlen(sv1_)&&strlen(sv2_)&&strlen(sv3_)&&strlen(sv4_)&&strlen(sv5_)&&!strlen(sv6_))
	{
	for(i=0;i<256;++i){sv6_[i]=sv1_[i];}
	for(i=0;i<256;++i){sv1_[i]='\0';}
	//printf("sv4_ %s\n",sv6_);
	}
	if(strlen(sv1_)&&strlen(sv2_)&&strlen(sv3_)&&strlen(sv4_)&&strlen(sv5_)&&strlen(sv6_)&&!strlen(sv7_))
	{
	for(i=0;i<256;++i){sv7_[i]=sv1_[i];}
	for(i=0;i<256;++i){sv1_[i]='\0';}
	//printf("sv4_ %s\n",sv7_);
	}
	if(strlen(sv1_)&&strlen(sv2_)&&strlen(sv3_)&&strlen(sv4_)&&strlen(sv5_)&&strlen(sv6_)&&strlen(sv7_)&&!strlen(sv8_))
	{
	for(i=0;i<256;++i){sv8_[i]=sv1_[i];}
	for(i=0;i<256;++i){sv1_[i]='\0';}
	//printf("sv4_ %s\n",sv8_);
	}
	if(strlen(sv1_)&&strlen(sv2_)&&strlen(sv3_)&&strlen(sv4_)&&strlen(sv5_)&&strlen(sv6_)&&strlen(sv7_)&&strlen(sv8_))
	{
	printf("sv1_ %s\t",sv1_);
	printf("sv2_ %s\t",sv2_);
	printf("sv3_ %s\t",sv3_);
	printf("sv4_ %s\t",sv4_);
	printf("sv5_ %s\t",sv5_);
	printf("sv6_ %s\t",sv6_);
	printf("sv7_ %s\t",sv7_);
	printf("sv8_ %s\t",sv8_);

	p_1(sv1_,sv2_,sv3_,sv4_,sv5_,sv6_,sv7_,sv8_);

	for(i=0;i<256;++i){sv1_[i]='\0';}
	for(i=0;i<256;++i){sv2_[i]='\0';}
	for(i=0;i<256;++i){sv3_[i]='\0';}
	for(i=0;i<256;++i){sv4_[i]='\0';}
	for(i=0;i<256;++i){sv5_[i]='\0';}	
	for(i=0;i<256;++i){sv6_[i]='\0';}	
	for(i=0;i<256;++i){sv7_[i]='\0';}	
	for(i=0;i<256;++i){sv8_[i]='\0';}		
	printf("%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\n",c1_,c2_,c3_,c4_,c5_,c6_,c7_,c8_,c9_);	
	//return(0);
	}
	}

	}
	}

	ca[0]=ca[cai-9];
	ca[1]=ca[cai-8];
	ca[2]=ca[cai-7];

	ca[3]=ca[cai-6];
	ca[4]=ca[cai-5];
	ca[5]=ca[cai-4];

	ca[6]=ca[cai-3];
	ca[7]=ca[cai-2];
	ca[8]=ca[cai-1];

	cai=8+1;

	}

	}
	fclose(f1);

	return(0);

}