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;
		
		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){
			i=0;
			while(out[i]!=NULL){
				printf("%c",out[i]);
				i++;
			}
			printf("\n");
			break;
			}
			
		}
		
	}
	
	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: In function 'conv':
main.c:69:21: warning: comparison between pointer and integer
   69 |         for(i=0;s[i]!=NULL;i++)s[i]=NULL;
      |                     ^~
main.c:69:36: error: assignment to 'char' from 'void *' makes integer from pointer without a cast [-Wint-conversion]
   69 |         for(i=0;s[i]!=NULL;i++)s[i]=NULL;
      |                                    ^
main.c:73:17: error: implicit declaration of function 'itoa' [-Wimplicit-function-declaration]
   73 |                 itoa(a,s,2);
      |                 ^~~~
main.c: In function 'cc':
main.c:106:32: error: assignment to 'char' from 'void *' makes integer from pointer without a cast [-Wint-conversion]
  106 |         for(i=0;i<1000;i++)c[i]=NULL;
      |                                ^
main.c:113:37: warning: comparison between pointer and integer
  113 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:118:37: warning: comparison between pointer and integer
  118 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:123:37: warning: comparison between pointer and integer
  123 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:132:37: warning: comparison between pointer and integer
  132 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:137:37: warning: comparison between pointer and integer
  137 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:142:37: warning: comparison between pointer and integer
  142 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:147:37: warning: comparison between pointer and integer
  147 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:152:37: warning: comparison between pointer and integer
  152 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:161:37: warning: comparison between pointer and integer
  161 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:166:37: warning: comparison between pointer and integer
  166 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:171:37: warning: comparison between pointer and integer
  171 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:176:37: warning: comparison between pointer and integer
  176 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:181:37: warning: comparison between pointer and integer
  181 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:190:37: warning: comparison between pointer and integer
  190 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:195:37: warning: comparison between pointer and integer
  195 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:200:37: warning: comparison between pointer and integer
  200 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:205:37: warning: comparison between pointer and integer
  205 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:210:37: warning: comparison between pointer and integer
  210 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:215:37: warning: comparison between pointer and integer
  215 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:220:37: warning: comparison between pointer and integer
  220 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:230:37: warning: comparison between pointer and integer
  230 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:235:37: warning: comparison between pointer and integer
  235 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:240:37: warning: comparison between pointer and integer
  240 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:245:37: warning: comparison between pointer and integer
  245 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:250:37: warning: comparison between pointer and integer
  250 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:255:37: warning: comparison between pointer and integer
  255 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:260:37: warning: comparison between pointer and integer
  260 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:265:37: warning: comparison between pointer and integer
  265 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:270:37: warning: comparison between pointer and integer
  270 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:275:37: warning: comparison between pointer and integer
  275 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:280:37: warning: comparison between pointer and integer
  280 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~
main.c:285:37: warning: comparison between pointer and integer
  285 |                         for(i=a;o[i]!=NULL;i++)c[i-a]=o[i];
      |                                     ^~