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

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

	std::string ret;

	std::string::const_iterator end = gen.end();
	for( std::string::const_iterator it=gen.begin(); it<end; ++it )
		ret += table[*it];

	if ( ret.size()%5 != 0 )
		ret.append( ((ret.size()/5)+1)*5-ret.size(), '0' );

	return ret;
}

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

	std::string ret;

	std::string::const_iterator end = gen.end();
	for( std::string::const_iterator it=gen.begin(); it<end; it+=5 )
		ret += table[std::string( it, it+5 )];

	return ret;
}

int main() {
	std::string s;
	while( getline( std::cin, s ) && !s.empty() )
		std::cout<<to_encrypted_str(to_bin_str( s ))<<std::endl;
}