#include <bits/stdc++.h>
#define range(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define rep(i,n) range(i,0,n)
using namespace std;

map<char,string> e;
map<string,char> d;

void init(){
	e[' ']="101";
	e['\'']="000000";
	e[',']="000011";
	e['-']="1001000";
	e['.']="010001";
	e['?']="000001";
	e['A']="100101";
	e['B']="10011010";
	e['C']="0101";
	e['D']="0001";
	e['E']="110";
	e['F']="01001";
	e['G']="10011011";
	e['H']="010000";
	e['I']="0111";
	e['J']="10011000";
	e['K']="0110";
	e['L']="00100";
	e['M']="10011001";
	e['N']="10011110";
	e['O']="00101";
	e['P']="111";
	e['Q']="10011111";
	e['R']="1000";
	e['S']="00110";
	e['T']="00111";
	e['U']="10011100";
	e['V']="10011101";
	e['W']="000010";
	e['X']="10010010";
	e['Y']="10010011";
	e['Z']="10010000";
	d["00000"]='A';
	d["00001"]='B';
	d["00010"]='C';
	d["00011"]='D';
	d["00100"]='E';
	d["00101"]='F';
	d["00110"]='G';
	d["00111"]='H';
	d["01000"]='I';
	d["01001"]='J';
	d["01010"]='K';
	d["01011"]='L';
	d["01100"]='M';
	d["01101"]='N';
	d["01110"]='O';
	d["01111"]='P';
	d["10000"]='Q';
	d["10001"]='R';
	d["10010"]='S';
	d["10011"]='T';
	d["10100"]='U';
	d["10101"]='V';
	d["10110"]='W';
	d["10111"]='X';
	d["11000"]='Y';
	d["11001"]='Z';
	d["11010"]=' ';
	d["11011"]='.';
	d["11100"]=',';
	d["11101"]='-';
	d["11110"]='\'';
	d["11111"]='?';
}

int main(void){
	string s;
	init();
	while(1){
		getline(cin,s);
		if(cin.eof())break;
		string encode="";
		rep(i,s.size()) encode+=e[s[i]];
		string decode="";
		for(int i=0;i<encode.size();i+=5){
			string tmp=encode.substr(i,5);
			while(tmp.size()<5) tmp+="0";
			decode+=d[tmp];
		}
		//cout << encode << endl;
		cout << decode << endl;
	}
	return 0;
}