#include <stdio.h>
#include <string.h>
#include <stdlib.h>
void chuanhoasau(char a[]){
	int i,j;
	if(a[0]==' ')//xoa dau
	{
		for(i=0;i<strlen(a);i++)
		{
			if(a[i]!=' ')
			{
				strcpy(a,&a[i]);
				break;
			}
		}
	}
	if(a[strlen(a)-1]== ' ')//xoa cuoi
	{
		for(i=strlen(a)-1;i>0;i--)
		{
			if(a[i]!=' ')
			{
				a[i+1]='\0';
				break;
			}
		}
	}
	for(i=0;i<strlen(a);i++)//xoa giua
	{
		if(a[i]==' ' && a[i+1]== ' ')
		{
			for(int j=i+1;j<strlen(a);j++)
			{
				if(a[j]!=' ')
				{
					strcpy(&a[i+1],&a[j]);
					break;
				}
			}
		}
		
	}
}
void sosanh(char b[])
{
		if(b[0]=='o' && b[1]=='k')
		{
			do{
			   system("COLOR 5F");
		    		printf("ok ! hi \n \t to doi cau ne tu lau lam roi, t cung yeu cau ");
						system("COLOR 5F");
							system("cls");
				}while(1); 
			}
		if(strcmp(b, "khong")==0){
			printf("ukm.biet the cha noi nua. chuc ban ngay moi vui ve.\n Rat vui khi ban da xem bai cua minh.");
		}
		
}
	

 main()
 { 
	char a[100];
 	char b[100];
 	printf("chuong trinh ne minh viet ra, tat ca nhung thu t code ra deu la loi that long \n\t nen mong cau hay tra loi that long nhe\n ");
 	  printf("neu dong y voi to thi hay chay no nhe \n con khong thi hay xoa no di ok :)\n");
 	    printf("\t\t\tdong y voi to thi an ok nhe :  ");
 	      gets(b);
 	       system("cls");
 	        if(strcmp(b, "ok")==0)
	            {
	            printf("\nluu y: dong y thi an ok\n\t\t con khong dong y thi an khong nhe!  \n");
 	              	printf("to rat la thich cau, va muon lam nguoi cau yeu thuong \n\t Lam nguoi yeu to nhe : ");
 	              		gets(b);
 	              			system("cls");
 	             				 if(strcmp(b, "ok")==0)
 	             					 printf("\nthat long day ?");
 	        do 
			 	{
 	        		fflush(stdin);
	           			 gets(b);
 	               			chuanhoasau(b);
 	                if(strcmp(b, "ok")==0 || strcmp(b, "khong")==0);
 	                   break;
               	} while (1);
 	                    chuanhoasau(b);
 	                        sosanh(b);
 	                        	printf("test");
                }
                  else
				   {
                      system("COLOR 78");
                         printf(" rat vui khi ban chay chuong chinh cua to\n\t chuc cau mot ngay tot lanh :) ");
                   }
 	  		do
 	  			{
 	  				system("COLOR 78");
 	  					system("cls");
 	  						system("COLOR 78");
 	  							printf("\nnhan bye de thoat chuong trinh: ");
 	  								gets(b);
 	  									system("cls");
 	  										puts(b);
 	  				
				}while(strcmp(b,"bye")!=0);	
        }






