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

static std::map<char, std::string> bin_table;

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

std::string to_bin_str( const std::string& gen )
{
	std::string ret;

	std::string::const_iterator end = gen.end();
	for( std::string::const_iterator it=gen.begin(); it<end; ++it )
		ret += bin_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 )
{
	const char table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-\'?";
	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::strtol( std::string( it, it+5 ).c_str(), 0, 2 )];

	return ret;
}

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