#include<map>
#include<string>
#include<iostream>

using namespace std;

int main()
{
	map<char,string> en;
	en[' ']="101";		en['\'']="000000";	en[',']="000011";
	en['-']="10010001";	en['.']="010001";	en['?']="000001";
	en['A']="100101";	en['B']="10011010";	en['C']="0101";
	en['D']="0001";		en['E']="110";		en['F']="01001";
	en['G']="10011011";	en['H']="010000";	en['I']="0111";
	en['J']="10011000";	en['K']="0110";		en['L']="00100";
	en['M']="10011001";	en['N']="10011110";	en['O']="00101";
	en['P']="111";		en['Q']="10011111";	en['R']="1000";
	en['S']="00110";	en['T']="00111";	en['U']="10011100";
	en['V']="10011101";	en['W']="000010";	en['X']="10010010";
	en['Y']="10010011";	en['Z']="10010000";

	map<string,char> de;
	de["00000"]='A';	de["00001"]='B';	de["00010"]='C';
	de["00011"]='D';	de["00100"]='E';	de["00101"]='F';
	de["00110"]='G';	de["00111"]='H';	de["01000"]='I';
	de["01001"]='J';	de["01010"]='K';	de["01011"]='L';
	de["01100"]='M';	de["01101"]='N';	de["01110"]='O';
	de["01111"]='P';	de["10000"]='Q';	de["10001"]='R';
	de["10010"]='S';	de["10011"]='T';	de["10100"]='U';
	de["10101"]='V';	de["10110"]='W';	de["10111"]='X';
	de["11000"]='Y';	de["11001"]='Z';	de["11010"]=' ';
	de["11011"]='.';	de["11100"]=',';	de["11101"]='-';
	de["11110"]='\'';	de["11111"]='?';

	string s,z[5];
	for(int i=1;i<5;i++)	z[i]+=z[i-1]+'0';
	while(getline(cin,s)){
		string code;
		for(int i=0;i<s.length();i++)		code+=en[s[i]];
		if(code.length()%5!=0)				code+=z[5-code.length()%5];
		for(int i=0;i<code.length();i+=5)	cout<<de[code.substr(i,5)];
		cout<<endl;
	}

	return 0;
}