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

char t[32][12]={
	"100101","10011010","0101","0001","110","01001","10011011","010000","0111",
	"10011000","0110","00100","10011001","10011110","00101","111","10011111",
	"1000","00110","00111","10011100","10011101","000010","10010010",
	"10010011","10010000",
	"101","000000","000011","10010001","010001","000001"
};

int main(void){
	int i,j;
	char c,s[2048],f[8],*e;

	while(1){
		i = 0;
		while(1){
			c = getchar();

			if(c==EOF) return 0;
			else if(c=='\n') break;
			else if(isalpha(c)) j = c - 'A';
			else if(c==' ') j = 26;
			else if(c=='\'') j = 27;
			else if(c==',') j = 28;
			else if(c=='-') j = 29;
			else if(c=='.') j = 30;
			else j = 31;

			strcpy(&s[i],t[j]);
			i += strlen(t[j]);
		}
		if(i % 5 != 0){
			for(;i%5!=0;i++) s[i] = '0';
			s[i] = 0;
		}

		for(i=0;s[i]!=0;i+=5){
			strncpy(f,&s[i],5);
			f[5] = 0;

			j = strtol(f,&e,2);

			if(j<26) putchar('A'+j);
			else if(j==26) putchar(' ');
			else if(j==27) putchar('.');
			else if(j==28) putchar(',');
			else if(j==29) putchar('-');
			else if(j==30) putchar('\'');
			else putchar('?');
		}

		putchar('\n');
	}
}