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

void hantei(char *str);

char DataBase[][3][80] =
	{
	/* [文字] ,[符号＿変換前] ,[符号＿変換後] */
	{ " ", "101", "11010" },{ "\'", "000000", "11110" },{ ",", "000011", "11100" },{ "-", "10010001", "11101" },
	{ ".", "010001", "11011" },{ "?", "000001", "11111" },{ "A", "100101", "00000" },{ "B", "10011010", "00001" },
    { "C", "0101", "00010" },{ "D", "0001", "00011" },{ "E", "110", "00100" },{ "F", "01001", "00101" },
	{ "G", "10011011", "00110" },{ "H", "010000", "00111" },{ "I", "0111", "01000" },{ "J", "10011000", "01001" },
	{ "K", "0110", "01010" },{ "L", "00100", "01011" },{ "M", "10011001", "01100" },{ "N", "10011110", "01101" },
	{ "O", "00101", "01110" },{ "P", "111", "01111" },{ "Q", "10011111", "10000" },{ "R", "1000", "10001" },
	{ "S", "00110", "10010" },{ "T", "00111", "10011" },{ "U", "10011100", "10100" },{ "V", "10011101", "10101" },
	{ "W", "000010", "10110" },{ "X", "10010010", "10111" },{ "Y", "10010011", "11000" },{ "Z", "100100000", "11001" },
    {"", "", "" }
};


int main(void)
{
	char str1[1000],str2[1000],ch;
	int cut_i;
	
	/*scanf("%[A-Z \'.?,-]",str);
		hantei(str1);*/
	cut_i=0;
	while((ch = getchar())!=EOF){
		if(ch !='\n'){
			str2[cut_i] = ch;
			cut_i++;
		}
		else {
			if(cut_i==0){
				exit(1);
			}
			else {
				strncpy(str1,str2,cut_i);
			}
			str1[cut_i]='\0';
			hantei(str1);
			printf("\n");
			cut_i=0;
		}
	}
	return 0;
}



void hantei(char *str)
{
	int len1,cut_i,cut_j,count;
	char ans[1000]={""},str2[1000]={""},str3[1000]={""};
	char zero[]={"0000"};

	len1 = strlen(str);
	count = 0;

	for(cut_i=0;cut_i<len1;cut_i++){
		cut_j=0;
		while(strcmp(DataBase[cut_j][0],"")){
			if(!strncmp((str+cut_i),DataBase[cut_j][0],1)){
				if(count == 0){
					strcpy(str2,DataBase[cut_j][1]);
					count = strlen(str2);
				}
				else if(count !=0){
					strcpy(str2+count,DataBase[cut_j][1]);
					count = strlen(str2);
				}
				break;
			}
			cut_j++;
		}
	}
	
	len1 = strlen(str2);
	count = 0;

	if( len1 % 5 != 0){
		cut_i = 5 - len1 % 5;
		strncat(str2,zero,cut_i);
		len1 = strlen(str2);
	}


	for(cut_i=0;cut_i<len1;cut_i+=5){
		cut_j=0;
		strncpy(str3,str2+cut_i,5);
		while(strcmp(DataBase[cut_j][0],"")){
			if(strcmp(str3,DataBase[cut_j][2]) == 0){
				if(count == 0){
					strcpy(ans,DataBase[cut_j][0]);
					count =strlen(ans);
				}
				else{
					strcat(ans,DataBase[cut_j][0]);
				}
				break;
			}
			cut_j++;
		}
	}
	printf(ans);
}