#include<iostream>
#include<unordered_map>
#include<string>
using namespace std;

int main(void){

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

	while(getline(cin,str)){
		if(str.length()<=0)break;
		string enc,enc2;
		for(int i=0;i<str.length();i++){
		enc+=hs[str[i]];
		}
		int enclen=enc.length()%5;
		if(enclen>0){while(enclen<5){enc+="0";enclen++;}}
		for(int j=0;j<enc.length();j+=5)enc2+=hs2[enc.substr(j,5)];
	cout<<enc2<<endl;
	}

return 0;
}

