#define _USE_MATH_DEFINES
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<queue>
#include<map>
#include<set>
#include<vector>
#include<list>
#include<stack>
#include<cstring>
#include<string>
#include<cmath>
using namespace std;
#define LATTE 1000000000

int main(){
	char con1[32][9]={"101","000000","000011","10010001","010001","000001","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"};
	char S[102],con2[32];
	for(int i=0;i<26;i++) con2[i] = 'A'+i;
	con2[26]=' '; con2[27]='.'; con2[28]=','; con2[29]='_'; con2[30]='\'',con2[31]='?';
	while(true){
		int r,c;
		char cons[900]={};
		for(int i=0;r=scanf("%c",&S[i]),S[i]!='\n';i++){
			if(r==EOF) return 0;
			if(S[i]==' ') c = 0;
			else if(S[i]=='\'') c = 1;
			else if(S[i]==',') c = 2;
			else if(S[i]=='_') c = 3;
			else if(S[i]=='.') c = 4;
			else if(S[i]=='?') c = 5;
			else c = S[i]-'A'+6;
			strcat(cons,con1[c]);
		}
		int len = strlen(cons);
		for(int i=(len-1)%5+1;i<5;i++){
			cons[len++]='0'; cons[len]='\0';
		}
		for(int i=0;i<len;){
			int latte=0;
			for(int j=0;j<5;i++,j++){
				//printf("%c",cons[i]);
				latte = latte<<1;
				if(cons[i]=='1') latte += 1;
			}//printf(" ");
			printf("%c",con2[latte]);
		}puts("");
	}
	return 0;
}