#include <bits/stdc++.h>

using namespace std;

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


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


	while( cin >> input )
	{
		start += input + ' ';
	}
	start = start.substr ( 0 , start.size () - 1 );
	for( auto x : start )
	{
		output += code[x];
	}
	while( output.size () % 5 )output += "0";
	for( size_t i = 0; i < output.size (); i += 5 )
	{
		ans += code2[output.substr ( i , 5 )];
	}
	cout << ans << endl;
}