Language: C

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

void conv(char *s,char c);
void cc(char *t,char *o,char *out);

int main(void){
	char in[100]={""},o[1000]={""},s[20]={""},out[1000]={""},t[20]={""};
	int i,l,step=0,f=0;
	
	
	
	while(scanf("%s",in)!=EOF){
		step=0;
		f=0;
		i=0;
		while(o[i]!=NULL){
			o[i]=NULL;
			i++;
		}
		
		while(1){
			while(strlen(o)<=8){
				conv(s,in[step]);
				if(strlen(s)<5){
					strcpy(t,s);
					for(i=0;i<20;i++)s[i]=NULL;
					for(i=0;(unsigned int)i<(unsigned int)5-strlen(t);i++)s[i]='0';
					strcat(s,t);
				}
				strcat(o,s);
				step++;
			}
			for(i=3;i<8;i++){
				for(l=0;l<i;l++){
					t[l]=o[l];
				}
				for(;l<20;l++)t[l]=NULL;
				cc(t,o,out);
			}

			if(strcmp(t,o)==0)f++;
			else f=0;
			if(f>4 || (unsigned int)step>=strlen(in)){
			i=0;
			while(out[i]!=NULL){
				printf("%c",out[i]);
				i++;
			}
			printf("\n");
			break;
			}
			
		}
		
		for(i=0;;i++){
			if(in[i]!=NULL)in[i]=NULL;
			else break;
		}
		
		for(i=0;;i++){
			if(out[i]!=NULL)out[i]=NULL;
			else break;
		}
		for(i=0;i<20;i++){
			s[i]=NULL;
			t[i]=NULL;
		}
	}
	
	return 0;
}





void conv(char *s,char c){
	int a,i;
	
	for(i=0;s[i]!=NULL;i++)s[i]=NULL;
	
	if(c<=90 && c>=65){
		a=c-65;
		itoa(a,s,2);
	}
	else{
		switch(c){
			case ' ':
			strcpy(s,"11010");
			break;
			case '.':
			strcpy(s,"11011");
			break;
			case ',':
			strcpy(s,"11100");
			break;
			case '-':
			strcpy(s,"11101");
			break;
			case '\'':
			strcpy(s,"11110");
			break;
			case '?':
			strcpy(s,"11111");
			break;
		}
	}
	
	return;
}


void cc(char *t,char *o,char *out){
	int i,l,a;
	char c[1000];
	
	for(i=0;i<1000;i++)c[i]=NULL;
	
	
	a=3;
	if(strlen(t)==(unsigned int)a){
		if(strcmp(t,"101")==0){
			out[strlen(out)]=' ';
			for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
			strcpy(o,c);
		}
		if(strcmp(t,"110")==0){
			out[strlen(out)]='E';
			for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
			strcpy(o,c);
		}
		if(strcmp(t,"111")==0){
			out[strlen(out)]='P';
			for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
			strcpy(o,c);
		}
	}
	
	a=4;
	if(strlen(t)==(unsigned int)a){
		if(strcmp(t,"0101")==0){
			out[strlen(out)]='C';
			for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
			strcpy(o,c);
		}
		if(strcmp(t,"0001")==0){
			out[strlen(out)]='D';
			for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
			strcpy(o,c);
		}
		if(strcmp(t,"0111")==0){
			out[strlen(out)]='I';
			for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
			strcpy(o,c);
		}
		if(strcmp(t,"0110")==0){
			out[strlen(out)]='K';
			for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
			strcpy(o,c);
		}
		if(strcmp(t,"1000")==0){
			out[strlen(out)]='R';
			for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
			strcpy(o,c);
		}
	}
	
	a=5;
	if(strlen(t)==(unsigned int)a){
		if(strcmp(t,"01001")==0){
			out[strlen(out)]='F';
			for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
			strcpy(o,c);
		}
		if(strcmp(t,"00100")==0){
			out[strlen(out)]='L';
			for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
			strcpy(o,c);
		}
		if(strcmp(t,"00101")==0){
			out[strlen(out)]='O';
			for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
			strcpy(o,c);
		}
		if(strcmp(t,"00110")==0){
			out[strlen(out)]='S';
			for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
			strcpy(o,c);
		}
		if(strcmp(t,"00111")==0){
			out[strlen(out)]='T';
			for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
			strcpy(o,c);
		}
	}
	
	a=6;
	if(strlen(t)==(unsigned int)a){
		if(strcmp(t,"000000")==0){
			out[strlen(out)]='\'';
			for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
			strcpy(o,c);
		}
		if(strcmp(t,"000011")==0){
			out[strlen(out)]=',';
			for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
			strcpy(o,c);
		}
		if(strcmp(t,"010001")==0){
			out[strlen(out)]='.';
			for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
			strcpy(o,c);
		}
		if(strcmp(t,"000001")==0){
			out[strlen(out)]='?';
			for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
			strcpy(o,c);
		}
		if(strcmp(t,"100101")==0){
			out[strlen(out)]='A';
			for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
			strcpy(o,c);
		}
		if(strcmp(t,"010000")==0){
			out[strlen(out)]='H';
			for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
			strcpy(o,c);
		}
		if(strcmp(t,"000010")==0){
			out[strlen(out)]='W';
			for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
			strcpy(o,c);
		}
	}
	
	
	a=8;
	if(strlen(t)==(unsigned int)a){
		if(strcmp(t,"10010001")==0){
			out[strlen(out)]='-';
			for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
			strcpy(o,c);
		}
		if(strcmp(t,"10011010")==0){
			out[strlen(out)]='B';
			for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
			strcpy(o,c);
		}
		if(strcmp(t,"10011011")==0){
			out[strlen(out)]='G';
			for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
			strcpy(o,c);
		}
		if(strcmp(t,"10011000")==0){
			out[strlen(out)]='J';
			for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
			strcpy(o,c);
		}
		if(strcmp(t,"10011001")==0){
			out[strlen(out)]='M';
			for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
			strcpy(o,c);
		}
		if(strcmp(t,"10011110")==0){
			out[strlen(out)]='N';
			for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
			strcpy(o,c);
		}
		if(strcmp(t,"10011111")==0){
			out[strlen(out)]='Q';
			for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
			strcpy(o,c);
		}
		if(strcmp(t,"100111001")==0){
			out[strlen(out)]='U';
			for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
			strcpy(o,c);
		}
		if(strcmp(t,"10011101")==0){
			out[strlen(out)]='V';
			for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
			strcpy(o,c);
		}
		if(strcmp(t,"10010010")==0){
			out[strlen(out)]='X';
			for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
			strcpy(o,c);
		}
		if(strcmp(t,"10010011")==0){
			out[strlen(out)]='Y';
			for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
			strcpy(o,c);
		}
		if(strcmp(t,"10010000")==0){
			out[strlen(out)]='Z';
			for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
			strcpy(o,c);
		}
	}
	
}
	
	
	
			
	
	
	


		
		
		

Compiler output:
main.c: In function 'main':
main.c:18:27: warning: comparison between pointer and integer
   18 |                 while(o[i]!=NULL){
      |                           ^~
main.c:19:29: error: assignment to 'char' from 'void *' makes integer from pointer without a cast [-Wint-conversion]
   19 |                         o[i]=NULL;
      |                             ^
main.c:28:62: error: assignment to 'char' from 'void *' makes integer from pointer without a cast [-Wint-conversion]
   28 |                                         for(i=0;i<20;i++)s[i]=NULL;
      |                                                              ^
main.c:39:51: error: assignment to 'char' from 'void *' makes integer from pointer without a cast [-Wint-conversion]
   39 |                                 for(;l<20;l++)t[l]=NULL;
      |                                                   ^
main.c:47:37: warning: comparison between pointer and integer
   47 |                         while(out[i]!=NULL){
      |                                     ^~
main.c:58:33: warning: comparison between pointer and integer
   58 |                         if(in[i]!=NULL)in[i]=NULL;
      |                                 ^~
main.c:58:45: error: assignment to 'char' from 'void *' makes integer from pointer without a cast [-Wint-conversion]
   58 |                         if(in[i]!=NULL)in[i]=NULL;
      |                                             ^
main.c:63:34: warning: comparison between pointer and integer
   63 |                         if(out[i]!=NULL)out[i]=NULL;
      |                                  ^~
main.c:63:47: error: assignment to 'char' from 'void *' makes integer from pointer without a cast [-Wint-conversion]
   63 |                         if(out[i]!=NULL)out[i]=NULL;
      |                                               ^
main.c:67:29: error: assignment to 'char' from 'void *' makes integer from pointer without a cast [-Wint-conversion]
   67 |                         s[i]=NULL;
      |                             ^
main.c:68:29: error: assignment to 'char' from 'void *' makes integer from pointer without a cast [-Wint-conversion]
   68 |                         t[i]=NULL;
      |                             ^
main.c: In function 'conv':
main.c:82:21: warning: comparison between pointer and integer
   82 |         for(i=0;s[i]!=NULL;i++)s[i]=NULL;
      |                     ^~
main.c:82:36: error: assignment to 'char' from 'void *' makes integer from pointer without a cast [-Wint-conversion]
   82 |         for(i=0;s[i]!=NULL;i++)s[i]=NULL;
      |                                    ^
main.c:86:17: error: implicit declaration of function 'itoa' [-Wimplicit-function-declaration]
   86 |                 itoa(a,s,2);
      |                 ^~~~
main.c: In function 'cc':
main.c:119:32: error: assignment to 'char' from 'void *' makes integer from pointer without a cast [-Wint-conversion]
  119 |         for(i=0;i<1000;i++)c[i]=NULL;
      |                                ^
main.c:126:37: warning: comparison between pointer and integer
  126 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:131:37: warning: comparison between pointer and integer
  131 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:136:37: warning: comparison between pointer and integer
  136 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:145:37: warning: comparison between pointer and integer
  145 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:150:37: warning: comparison between pointer and integer
  150 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:155:37: warning: comparison between pointer and integer
  155 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:160:37: warning: comparison between pointer and integer
  160 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:165:37: warning: comparison between pointer and integer
  165 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:174:37: warning: comparison between pointer and integer
  174 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:179:37: warning: comparison between pointer and integer
  179 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:184:37: warning: comparison between pointer and integer
  184 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:189:37: warning: comparison between pointer and integer
  189 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:194:37: warning: comparison between pointer and integer
  194 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:203:37: warning: comparison between pointer and integer
  203 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:208:37: warning: comparison between pointer and integer
  208 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:213:37: warning: comparison between pointer and integer
  213 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:218:37: warning: comparison between pointer and integer
  218 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:223:37: warning: comparison between pointer and integer
  223 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:228:37: warning: comparison between pointer and integer
  228 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:233:37: warning: comparison between pointer and integer
  233 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:243:37: warning: comparison between pointer and integer
  243 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:248:37: warning: comparison between pointer and integer
  248 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:253:37: warning: comparison between pointer and integer
  253 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:258:37: warning: comparison between pointer and integer
  258 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:263:37: warning: comparison between pointer and integer
  263 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:268:37: warning: comparison between pointer and integer
  268 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:273:37: warning: comparison between pointer and integer
  273 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:278:37: warning: comparison between pointer and integer
  278 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:283:37: warning: comparison between pointer and integer
  283 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:288:37: warning: comparison between pointer and integer
  288 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:293:37: warning: comparison between pointer and integer
  293 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:298:37: warning: comparison between pointer and integer
  298 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~